or
(defstruct (name <option>...) [<comment>] <slot-desc>...)
fsubr
Note that if :CONC-NAME appears, it should be before :INCLUDE.
Each slot description takes the form:
<name>or
(<name> <defexpr>)If the default initialization expression is not specified, the slot will be initialized to NIL if no keyword argument is passed to the creation function.
The optional :PRINT-FUNCTION overrides the default #S notation. The function must take three arguments, the structure instance, the stream, and the current printing depth.
DEFSTRUCT causes access functions to be created for each of the slots and also arranges that SETF will work with those access functions. The access function names are constructed by taking the structure name, appending a '-' and then appending the slot name. This can be overridden by using the :CONC-NAME option.
DEFSTRUCT also makes a creation function called MAKE-<structname>, a copy function called COPY-<structname> and a predicate function called <structname>-P. The creation function takes keyword arguments for each of the slots. Structures can be created using the #S( read macro, as well.
The property *struct-slots* is added to the symbol that names the structure. This property consists of an association list of slot names and closures that evaluate to the initial values (NIL if no initial value expression).
For instance:
(defstruct foo bar (gag 2))
creates the following functions:
(foo-bar <expr>)
(setf (foo-bar <expr>) <value>)
(foo-gag <expr>)
(setf (foo-gag <expr>) <value>)
(make-foo &key :bar :gag)
(copy-foo <expr>)
(foo-p <expr>)
XLISP-PLUS - Version 2.1g - Tom Almy
tom.almy@tek.com - 18 JUL 94
Generated with WebMaker