Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the trivial-types Reference Manual, version 0.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Dec 22 15:21:46 2020 GMT+0.
• Introduction | What trivial-types is all about | |
• Systems | The systems documentation | |
• Modules | The modules documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
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))
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
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
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
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
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
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
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
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
character-designator
function-designator
file-position-designator
list-designator
package-designator
pathname-designator
stream-designator
string-designator
file-associated-stream-p stream
Returns true if STREAM is a stream associated to a file.
file-associated-stream
Equivalent to (and stream (satisfies file-associated-stream-p))
.
non-nil &optional type
Equivalent to (and (not null) TYPE)
if TYPE is given,
otherwise (not null)
.
Examples:
(typep nil '(non-nil symbol)) => NIL
type-specifier-p type-specifier
Returns true if TYPE-SPECIFIER is a valid type specfiier.
type-expand type-specifier &optional env
Expand TYPE-SPECIFIER in the lexical environment ENV.
LLGPL
Next: Modules, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The trivial-types system |
Tomohiro Matsuyama
LLGPL
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))
0.1
trivial-types.asd (file)
src (module)
Modules are listed depth-first from the system components tree.
• The trivial-types/src module |
trivial-types (system)
src/
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
Next: The trivial-types/src/package․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
trivial-types.asd
trivial-types (system)
Next: The trivial-types/src/specials․lisp file, Previous: The trivial-types․asd file, Up: Lisp files [Contents][Index]
src (module)
src/package.lisp
Next: The trivial-types/src/lists․lisp file, Previous: The trivial-types/src/package․lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
src (module)
src/specials.lisp
*standard-optimize-qualities* (special variable)
Next: The trivial-types/src/designators․lisp file, Previous: The trivial-types/src/specials․lisp file, Up: Lisp files [Contents][Index]
specials.lisp (file)
src (module)
src/lists.lisp
%proper-list-p (macro)
Next: The trivial-types/src/streams․lisp file, Previous: The trivial-types/src/lists․lisp file, Up: Lisp files [Contents][Index]
lists.lisp (file)
src (module)
src/designators.lisp
Next: The trivial-types/src/combinators․lisp file, Previous: The trivial-types/src/designators․lisp file, Up: Lisp files [Contents][Index]
designators.lisp (file)
src (module)
src/streams.lisp
Next: The trivial-types/src/typespecs․lisp file, Previous: The trivial-types/src/streams․lisp file, Up: Lisp files [Contents][Index]
streams.lisp (file)
src (module)
src/combinators.lisp
non-nil (type)
Previous: The trivial-types/src/combinators․lisp file, Up: Lisp files [Contents][Index]
combinators.lisp (file)
src (module)
src/typespecs.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The trivial-types-asd package | ||
• The trivial-types package |
Next: The trivial-types package, Previous: Packages, Up: Packages [Contents][Index]
trivial-types.asd
Previous: The trivial-types-asd package, Up: Packages [Contents][Index]
package.lisp (file)
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported functions | ||
• Exported types |
Next: Exported types, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
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
lists.lisp (file)
Returns true if STREAM is a stream associated to a file.
streams.lisp (file)
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
lists.lisp (file)
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
lists.lisp (file)
Exactly same as LIST.
lists.lisp (file)
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
lists.lisp (file)
Expand TYPE-SPECIFIER in the lexical environment ENV.
typespecs.lisp (file)
Returns true if TYPE-SPECIFIER is a valid type specfiier.
typespecs.lisp (file)
Previous: Exported functions, Up: Exported definitions [Contents][Index]
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
lists.lisp (file)
designators.lisp (file)
Equivalent to ‘(and stream (satisfies file-associated-stream-p))‘.
streams.lisp (file)
designators.lisp (file)
designators.lisp (file)
designators.lisp (file)
Equivalent to ‘(and (not null) TYPE)‘ if TYPE is given,
otherwise ‘(not null)‘.
Examples:
(typep nil ’(non-nil symbol)) => NIL
combinators.lisp (file)
designators.lisp (file)
designators.lisp (file)
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
lists.lisp (file)
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
lists.lisp (file)
designators.lisp (file)
designators.lisp (file)
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
lists.lisp (file)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal special variables | ||
• Internal macros |
Next: Internal macros, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
specials.lisp (file)
Previous: Internal special variables, Up: Internal definitions [Contents][Index]
lists.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L M T |
---|
Jump to: | F L M T |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | %
A F M P T |
---|
Jump to: | %
A F M P T |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
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: Variable index, Up: Indexes [Contents][Index]
Jump to: | A C F L N P S T |
---|
Jump to: | A C F L N P S T |
---|