Scieneer Common Lisp 1.3.9 online documentation

defstruct name-and-options &rest slot-descriptions[Macro]

defstruct {name | (name option*)} {slot | (slot [default] {key value}*)}

Define the structure type name. Instances are created by make-<name>, which takes keyword arguments allowing initial slot values to the specified. A setf'able function <name>-<slot> is defined for each slot to read&write slot values. <name>-p is a type predicate.

Popular defstruct options:

(:constructor name) (:predicate name)
Specify an alternate name for the constructor or predicate.
(:constructor name lambda-list)
Explicitly specify the name and arguments to create 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.
:raw-type raw-type
The type used to determine the storage used for the slot. The slot type must be a subtype of the raw-type. The raw-type defaults to the slot type and is ignored in included slots which inherit the storage type. Raw unboxed storage is chosen when the type permits, and this is supported for specialized float types, complex float types, and unsigned words. The use of raw unboxed storage can help avoid consing, but can be disabled by specifying the type t for the :raw-type option.