Macro: COMMON-LISP:DEFSTRUCT¶
DEFSTRUCT {Name | (Name Option)} [Documentation] {Slot | (Slot [Default] {Key Value})} Define the structure type Name. Instances are created by MAKE-
, which takes &KEY arguments allowing initial slot values to the specified. A SETF’able function - is defined for each slot to read and write slot values. -p is a type predicate. Popular DEFSTRUCT options (see manual for others):
(:CONSTRUCTOR Name) (:PREDICATE Name) Specify the name for the constructor or predicate.
(:CONSTRUCTOR Name Lambda-List) Specify the name and arguments for a BOA constructor (which is more efficient when keyword syntax isn’t necessary.)
(:INCLUDE Supertype Slot-Spec*) Make this type a subtype of the structure type Supertype. The optional Slot-Specs override inherited slot options.
Slot options:
:TYPE Type-Spec Asserts that the value of this slot is always of the specified type.
:READ-ONLY {T | NIL} If true, no setter function is defined for this slot.
Lambda list¶
(sb-kernel::name-and-options &rest sb-kernel::slot-descriptions)