Star Sapphire Common LISP Home

Download Star Saphire
Index

19. STRUCTURES

A structure is a collection of objects which can be of different types. Each object contained in a structure has a name; the structure itself constitutes a new, user defined type type.

This is not unique to Common LISP; this corresponds to structs in C or records in Pascal. The difference between Common LISP and these languages is that when a structure is defined, functions are generated automatically which allow the construction of these structures and retrieval and assignment of values to their components. This is a key link between structures as found in other languages and the concept of classes, as found in the Common LISP Object System (CLOS) or C++. Classes take this further by allowing association of arbitrary functions with the structure, known (in CLOS) as methods.

The structure facility is implemented through the following macro, q.v.:

defstruct