17.05.2015 Views

zl:1 - FTP

zl:1 - FTP

zl:1 - FTP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

defstruct-define-type 156<br />

,<br />

I •<br />

The :export opton is accepted by <strong>zl</strong>:defstruct but not by defstruct. Stylistically,<br />

it is preferable to export any external interfaces in the package<br />

declarations instead of scattering :export options throughout a program's<br />

source files.<br />

: export The :export option exports the specified symbols from<br />

the package in which the structure is defined. This option<br />

accepts the following as arguments: the names of<br />

slots and the following options: :alterant, : constructor,<br />

:copier, :predicate, :size-macro, and :size-symbol.<br />

The following example shows the use of : export.<br />

(<strong>zl</strong> :defstruct (2d-moving-object<br />

(:type :array)<br />

:conc-name<br />

mass<br />

x-pas<br />

y-pos<br />

x-velocity<br />

y-velocity)<br />

;; export all accessors and the<br />

;; make-2d-moving-object constructor<br />

(:export :accessors :constructor))<br />

See the section "Importing and Exporting Symbols" in<br />

Symbolics Common Lisp: Language Concepts.<br />

defstruct-define-type type &body options Macro<br />

Teaches defstruct and <strong>zl</strong>:defstruct about new types that it can use to<br />

implement structures.<br />

The body of this function is shown in the following example:<br />

(defstruct-define-type type<br />

option-l<br />

option-2<br />

... )<br />

where each option is either the symbolic name of an option or a list of the<br />

form (option-name. rest). See the section "Options To<br />

defstruct-define-type" in Symbolics Common Lisp: Language Concepts.<br />

Different options interpret rest in different ways. The symbol type is given<br />

an si:defstruct-type-description property of a structure that describes the<br />

type completely.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!