define-struct
(define-struct NAME (NAME ...))
The define-struct form is used to define a new kind of structure. The structure's fields are named by the names in parentheses. After evaluation of a define-struct form, a set of new procedures is available for creation, extraction, and type-like queries: - make-<struct-name> : takes a number of arguments equal to the number of fields in the structure, and creates a new instance of this structure.
- <struct-name>-<field-name> : takes an instance of the structure and returns the field named by <field-name>.
- <struct-name>? : takes any value, returns true if the value is an instance of the structure.
It is an error for any of the created names to be the same as a primitive or another user definition. Intermediate Student Table of Contents