The trivial-types Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The trivial-types Reference Manual

This is the trivial-types Reference Manual, version 0.1, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 12:42:37 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

trivial-types - Trivial type definitions

TRIVIAL-TYPES provides missing but important type definitions such as PROPER-LIST, ASSOCIATION-LIST, PROPERTY-LIST and TUPLE.

By using these types, you can keep type declarations more accurate. For example, you may write a class definition like:

(defclass person ()
  ((name :type string))
  ((age :type fixnum))
  ((friends :type list)))

However, it is not obvious for anyone except you that FRIENDS slot has only a list of person. If you want declare FRIENDS slot more accurately, PROPER-LIST is the best for that:

(defclass person ()
  ((name :type string))
  ((age :type fixnum))
  ((friends :type (proper-list person))))

In addition, TRIVIAL-TYPES also provides standard designators defined in ANSI standard such as PACKAGE-DESIGNATOR. They are useful when you write a function that takes a package-oid argument like:

(defun list-external-symbols (package)
  (declare (package-designator package))
  (loop for symbol being the external-symbol of package
        collect symbol))

[Package] trivial-types

[Function] proper-list-p

proper-list-p object

Returns true if OBJECT is a proper list.

Examples:

(proper-list-p 1) => NIL
(proper-list-p '(1 . 2)) => NIL
(proper-list-p nil) => T
(proper-list-p '(1 2 3)) => T

[Type] proper-list

proper-list &optional (element-type '*)

Equivalent to (and list (satisfies proper-list-p)). ELEMENT-TYPE is just ignored.

Examples:

(typep '(1 2 3) '(proper-list integer)) => T
(typep '(1 2 3) '(proper-list string)) => T

[Function] property-list-p

property-list-p object

Returns true if OBJECT is a property list.

Examples:

(property-list-p 1) => NIL
(property-list-p '(1 2 3)) => NIL
(property-list-p '(foo)) => NIL
(property-list-p nil) => T
(property-list-p '(foo 1)) => T
(property-list-p '(:a 1 :b 2)) => T

[Type] property-list

property-list &optional (value-type '*)

Equivalent to (and list (satisfies property-list-p)). VALUE-TYPE is just ignored.

Examples:

(typep '(:a 1 :b 2) '(property-list integer)) => T
(typep '(:a 1 :b 2) '(property-list string)) => T

[Function] association-list-p

association-list-p var

Returns true if OBJECT is an association list.

Examples:

(association-list-p 1) => NIL
(association-list-p '(1 2 3)) => NIL
(association-list-p nil) => T
(association-list-p '((foo))) => T
(association-list-p '((:a . 1) (:b . 2))) => T

[Type] association-list

association-list &optional (key-type '*) (value-type '*)

Equivalent to (proper-list (cons KEY-TYPE VALUE-TYPE)). KEY-TYPE and VALUE-TYPE are just ignored.

Examples:

(typep '((:a . 1) (:b . 2)) '(association-list integer)) => T
(typep '((:a . 1) (:b . 2)) '(association-list string)) => T

[Function] tuplep

tuplep object

Returns true if OBJECT is a tuple, meaning a proper list.

Examples:

(tuplep 1) => NIL
(tuplep '(1 . 2)) => NIL
(tuplep nil) => T
(tuplep '(1 2 3)) => T

[Type] tuple

tuple &rest element-types

Equivalent to (and list (cons ARG1 (cons ARG2 (cons ARG3 ...)))) where ARGn is each element of ELEMENTS-TYPES.

Examples:

(typep 1 'tuple) => NIL
(typep '(1 . 2) 'tuple) => NIL
(typep '(1 2 3) 'tuple) => NIL
(typep '(1 2 3) '(tuple integer integer)) => NIL
(typep '(1 2 3) '(tuple string integer integer)) => NIL
(typep nil 'tuple) => T
(typep nil '(tuple)) => T
(typep '(1 2 3) '(tuple integer integer integer)) => T

[Type] character-designator

character-designator

[Type] function-designator

function-designator

[Type] file-position-designator

file-position-designator

[Type] list-designator

list-designator

[Type] package-designator

package-designator

[Type] pathname-designator

pathname-designator

[Type] stream-designator

stream-designator

[Type] string-designator

string-designator

[Function] file-associated-stream-p

file-associated-stream-p stream

Returns true if STREAM is a stream associated to a file.

[Type] file-associated-stream

file-associated-stream

Equivalent to (and stream (satisfies file-associated-stream-p)).

[Type] non-nil

non-nil &optional type

Equivalent to (and (not null) TYPE) if TYPE is given, otherwise (not null).

Examples:

(typep nil '(non-nil symbol)) => NIL

[Function] type-specifier-p

type-specifier-p type-specifier

Returns true if TYPE-SPECIFIER is a valid type specfiier.

[Function] type-expand

type-expand type-specifier &optional env

Expand TYPE-SPECIFIER in the lexical environment ENV.

Authors

License

LLGPL


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 trivial-types

Author

Tomohiro Matsuyama

License

LLGPL

Description

Trivial type definitions

Long Description

TRIVIAL-TYPES provides missing but important type
definitions such as PROPER-LIST, ASSOCIATION-LIST, PROPERTY-LIST and TUPLE.

By using these types, you can keep type declarations more accurate. For example, you may write a class definition like:

(defclass person ()
((name :type string))
((age :type fixnum))
((friends :type list)))

However, it is not obvious for anyone except you that FRIENDS slot has only a list of person. If you want declare FRIENDS slot more accurately, PROPER-LIST is the best for that:

(defclass person ()
((name :type string))
((age :type fixnum))
((friends :type (proper-list person))))

In addition, TRIVIAL-TYPES also provides standard designators defined in ANSI standard such as PACKAGE-DESIGNATOR. They are useful when you write a function that takes a package-oid argument like:

(defun list-external-symbols (package)
(declare (package-designator package))
(loop for symbol being the external-symbol of package collect symbol))

Version

0.1

Source

trivial-types.asd (file)

Component

src (module)


Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

Modules are listed depth-first from the system components tree.


Previous: , Up: Modules   [Contents][Index]

3.1 trivial-types/src

Parent

trivial-types (system)

Location

src/

Components

Next: , Previous: , Up: Top   [Contents][Index]

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 trivial-types.asd

Location

trivial-types.asd

Systems

trivial-types (system)

Packages

trivial-types-asd


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.2 trivial-types/src/package.lisp

Parent

src (module)

Location

src/package.lisp

Packages

trivial-types


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.3 trivial-types/src/specials.lisp

Dependency

package.lisp (file)

Parent

src (module)

Location

src/specials.lisp

Internal Definitions

*standard-optimize-qualities* (special variable)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.4 trivial-types/src/lists.lisp

Dependency

specials.lisp (file)

Parent

src (module)

Location

src/lists.lisp

Exported Definitions
Internal Definitions

%proper-list-p (macro)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.5 trivial-types/src/designators.lisp

Dependency

lists.lisp (file)

Parent

src (module)

Location

src/designators.lisp

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.6 trivial-types/src/streams.lisp

Dependency

designators.lisp (file)

Parent

src (module)

Location

src/streams.lisp

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.7 trivial-types/src/combinators.lisp

Dependency

streams.lisp (file)

Parent

src (module)

Location

src/combinators.lisp

Exported Definitions

non-nil (type)


Previous: , Up: Lisp files   [Contents][Index]

4.1.8 trivial-types/src/typespecs.lisp

Dependency

combinators.lisp (file)

Parent

src (module)

Location

src/typespecs.lisp

Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

5.1 trivial-types-asd

Source

trivial-types.asd

Use List

Previous: , Up: Packages   [Contents][Index]

5.2 trivial-types

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Functions

Function: association-list-p VAR

Returns true if OBJECT is an association list.

Examples:

(association-list-p 1) => NIL (association-list-p ’(1 2 3)) => NIL (association-list-p nil) => T (association-list-p ’((foo))) => T (association-list-p ’((:a . 1) (:b . 2))) => T

Package

trivial-types

Source

lists.lisp (file)

Function: file-associated-stream-p STREAM

Returns true if STREAM is a stream associated to a file.

Package

trivial-types

Source

streams.lisp (file)

Function: proper-list-p OBJECT

Returns true if OBJECT is a proper list.

Examples:

(proper-list-p 1) => NIL (proper-list-p ’(1 . 2)) => NIL (proper-list-p nil) => T (proper-list-p ’(1 2 3)) => T

Package

trivial-types

Source

lists.lisp (file)

Function: property-list-p OBJECT

Returns true if OBJECT is a property list.

Examples:

(property-list-p 1) => NIL (property-list-p ’(1 2 3)) => NIL (property-list-p ’(foo)) => NIL (property-list-p nil) => T (property-list-p ’(foo 1)) => T (property-list-p ’(:a 1 :b 2)) => T

Package

trivial-types

Source

lists.lisp (file)

Function: tuple &rest ARGS

Exactly same as LIST.

Package

trivial-types

Source

lists.lisp (file)

Function: tuplep OBJECT

Returns true if OBJECT is a tuple, meaning a proper list.

Examples:

(tuplep 1) => NIL
(tuplep ’(1 . 2)) => NIL
(tuplep nil) => T
(tuplep ’(1 2 3)) => T

Package

trivial-types

Source

lists.lisp (file)

Function: type-expand TYPE-SPECIFIER &optional ENV

Expand TYPE-SPECIFIER in the lexical environment ENV.

Package

trivial-types

Source

typespecs.lisp (file)

Function: type-specifier-p TYPE-SPECIFIER

Returns true if TYPE-SPECIFIER is a valid type specfiier.

Package

trivial-types

Source

typespecs.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Types

Type: association-list &optional KEY-TYPE VALUE-TYPE

Equivalent to ‘(proper-list (cons KEY-TYPE VALUE-TYPE))‘. KEY-TYPE and VALUE-TYPE are just ignored.

Examples:

(typep ’((:a . 1) (:b . 2)) ’(association-list integer)) => T (typep ’((:a . 1) (:b . 2)) ’(association-list string)) => T

Package

trivial-types

Source

lists.lisp (file)

Type: character-designator ()
Package

trivial-types

Source

designators.lisp (file)

Type: file-associated-stream ()

Equivalent to ‘(and stream (satisfies file-associated-stream-p))‘.

Package

trivial-types

Source

streams.lisp (file)

Type: file-position-designator ()
Package

trivial-types

Source

designators.lisp (file)

Type: function-designator ()
Package

trivial-types

Source

designators.lisp (file)

Type: list-designator ()
Package

trivial-types

Source

designators.lisp (file)

Type: non-nil &optional TYPE

Equivalent to ‘(and (not null) TYPE)‘ if TYPE is given, otherwise ‘(not null)‘.

Examples:

(typep nil ’(non-nil symbol)) => NIL

Package

trivial-types

Source

combinators.lisp (file)

Type: package-designator ()
Package

trivial-types

Source

designators.lisp (file)

Type: pathname-designator ()
Package

trivial-types

Source

designators.lisp (file)

Type: proper-list &optional ELEMENT-TYPE

Equivalent to ‘(and list (satisfies proper-list-p))‘. ELEMENT-TYPE is just ignored.

Examples:

(typep ’(1 2 3) ’(proper-list integer)) => T
(typep ’(1 2 3) ’(proper-list string)) => T

Package

trivial-types

Source

lists.lisp (file)

Type: property-list &optional VALUE-TYPE

Equivalent to ‘(and list (satisfies property-list-p))‘. VALUE-TYPE is just ignored.

Examples:

(typep ’(:a 1 :b 2) ’(property-list integer)) => T (typep ’(:a 1 :b 2) ’(property-list string)) => T

Package

trivial-types

Source

lists.lisp (file)

Type: stream-designator ()
Package

trivial-types

Source

designators.lisp (file)

Type: string-designator ()
Package

trivial-types

Source

designators.lisp (file)

Type: tuple &rest ELEMENT-TYPES

Equivalent to ‘(and list (cons ARG1 (cons ARG2 (cons ARG3 ...))))‘ where ARGn is each element of ELEMENT-TYPES.

Examples:

(typep 1 ’tuple) => NIL
(typep ’(1 . 2) ’tuple) => NIL
(typep ’(1 2 3) ’tuple) => NIL
(typep ’(1 2 3) ’(tuple integer integer)) => NIL
(typep ’(1 2 3) ’(tuple string integer integer)) => NIL (typep nil ’tuple) => T
(typep nil ’(tuple)) => T
(typep ’(1 2 3) ’(tuple integer integer integer)) => T

Package

trivial-types

Source

lists.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

6.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.1 Special variables

Special Variable: *standard-optimize-qualities*
Package

trivial-types

Source

specials.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

6.2.2 Macros

Macro: %proper-list-p VAR &optional ELEMENT-TYPE
Package

trivial-types

Source

lists.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   M   T  
Index Entry  Section

F
File, Lisp, trivial-types.asd: The trivial-types<dot>asd file
File, Lisp, trivial-types/src/combinators.lisp: The trivial-types/src/combinators<dot>lisp file
File, Lisp, trivial-types/src/designators.lisp: The trivial-types/src/designators<dot>lisp file
File, Lisp, trivial-types/src/lists.lisp: The trivial-types/src/lists<dot>lisp file
File, Lisp, trivial-types/src/package.lisp: The trivial-types/src/package<dot>lisp file
File, Lisp, trivial-types/src/specials.lisp: The trivial-types/src/specials<dot>lisp file
File, Lisp, trivial-types/src/streams.lisp: The trivial-types/src/streams<dot>lisp file
File, Lisp, trivial-types/src/typespecs.lisp: The trivial-types/src/typespecs<dot>lisp file

L
Lisp File, trivial-types.asd: The trivial-types<dot>asd file
Lisp File, trivial-types/src/combinators.lisp: The trivial-types/src/combinators<dot>lisp file
Lisp File, trivial-types/src/designators.lisp: The trivial-types/src/designators<dot>lisp file
Lisp File, trivial-types/src/lists.lisp: The trivial-types/src/lists<dot>lisp file
Lisp File, trivial-types/src/package.lisp: The trivial-types/src/package<dot>lisp file
Lisp File, trivial-types/src/specials.lisp: The trivial-types/src/specials<dot>lisp file
Lisp File, trivial-types/src/streams.lisp: The trivial-types/src/streams<dot>lisp file
Lisp File, trivial-types/src/typespecs.lisp: The trivial-types/src/typespecs<dot>lisp file

M
Module, trivial-types/src: The trivial-types/src module

T
trivial-types.asd: The trivial-types<dot>asd file
trivial-types/src: The trivial-types/src module
trivial-types/src/combinators.lisp: The trivial-types/src/combinators<dot>lisp file
trivial-types/src/designators.lisp: The trivial-types/src/designators<dot>lisp file
trivial-types/src/lists.lisp: The trivial-types/src/lists<dot>lisp file
trivial-types/src/package.lisp: The trivial-types/src/package<dot>lisp file
trivial-types/src/specials.lisp: The trivial-types/src/specials<dot>lisp file
trivial-types/src/streams.lisp: The trivial-types/src/streams<dot>lisp file
trivial-types/src/typespecs.lisp: The trivial-types/src/typespecs<dot>lisp file

Jump to:   F   L   M   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   %  
A   F   M   P   T  
Index Entry  Section

%
%proper-list-p: Internal macros

A
association-list-p: Exported functions

F
file-associated-stream-p: Exported functions
Function, association-list-p: Exported functions
Function, file-associated-stream-p: Exported functions
Function, proper-list-p: Exported functions
Function, property-list-p: Exported functions
Function, tuple: Exported functions
Function, tuplep: Exported functions
Function, type-expand: Exported functions
Function, type-specifier-p: Exported functions

M
Macro, %proper-list-p: Internal macros

P
proper-list-p: Exported functions
property-list-p: Exported functions

T
tuple: Exported functions
tuplep: Exported functions
type-expand: Exported functions
type-specifier-p: Exported functions

Jump to:   %  
A   F   M   P   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*standard-optimize-qualities*: Internal special variables

S
Special Variable, *standard-optimize-qualities*: Internal special variables

Jump to:   *  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   A   C   F   L   N   P   S   T  
Index Entry  Section

A
association-list: Exported types

C
character-designator: Exported types

F
file-associated-stream: Exported types
file-position-designator: Exported types
function-designator: Exported types

L
list-designator: Exported types

N
non-nil: Exported types

P
Package, trivial-types: The trivial-types package
Package, trivial-types-asd: The trivial-types-asd package
package-designator: Exported types
pathname-designator: Exported types
proper-list: Exported types
property-list: Exported types

S
stream-designator: Exported types
string-designator: Exported types
System, trivial-types: The trivial-types system

T
trivial-types: The trivial-types system
trivial-types: The trivial-types package
trivial-types-asd: The trivial-types-asd package
tuple: Exported types
Type, association-list: Exported types
Type, character-designator: Exported types
Type, file-associated-stream: Exported types
Type, file-position-designator: Exported types
Type, function-designator: Exported types
Type, list-designator: Exported types
Type, non-nil: Exported types
Type, package-designator: Exported types
Type, pathname-designator: Exported types
Type, proper-list: Exported types
Type, property-list: Exported types
Type, stream-designator: Exported types
Type, string-designator: Exported types
Type, tuple: Exported types

Jump to:   A   C   F   L   N   P   S   T