chickadee » datatype » define-datatype

(define-datatype TYPENAME [PREDICATE] VARIANT ...)syntax

Defines a record type named TYPENAME, where VARIANT ... defines one or more constructors for instances of this type. VARIANT should be of the form

 VARIANT = (CONSTRUCTOR (FIELDNAME FIELDPRED) ...)

CONSTRUCTOR is the name of a constructor procedure that will be defined with as many arguments as fields are specified. (FIELDNAME FIELDPRED) ... specify the name for each field and a procedure of one argment that should return a true value for legal field values.

The optional PREDICATE should be the name of a procedure that will be defined and which returns #t when applied to an instance of this variant record.