chickadee » chicken » base » define-record

(define-record NAME SLOTNAME ...)syntax

Defines a record type. This defines a number of procedures for creating, accessing, and modifying record members.

Call make-NAME to create an instance of the structure (with one initialization-argument for each slot, in the listed order).

(NAME? STRUCT) tests any object for being an instance of this structure.

Slots are accessed via (NAME-SLOTNAME STRUCT) and updated using (NAME-SLOTNAME-set! STRUCT VALUE).

(define-record point x y)
(define p1 (make-point 123 456))
(point? p1)                      ==> #t
(point-x p1)                     ==> 123
(point-y-set! p1 99)
(point-y p1)                     ==> 99