rnrs records syntactic
The (rnrs records syntactic (6)) library exports the syntactic API for working with R6RS records.
Scheme Syntax: define-record-type name-spec record-clause …
Defines a new record type, introducing bindings for a record-type descriptor, a record constructor descriptor, a constructor procedure, a record predicate, and accessor and mutator procedures for the new record type’s fields.
name-spec must either be an identifier or must take the form (record-name constructor-name predicate-name), where record-name, constructor-name, and predicate-name are all identifiers and specify the names to which, respectively, the record-type descriptor, constructor, and predicate procedures will be bound. If name-spec is only an identifier, it specifies the name to which the generated record-type descriptor will be bound.
Each record-clause must be one of the following:
(fields field-spec*), where eachfield-specspecifies a field of the new record type and takes one of the following forms:(immutable field-name accessor-name), which specifies an immutable field with the namefield-nameand binds an accessor procedure for it to the name given byaccessor-name(mutable field-name accessor-name mutator-name), which specifies a mutable field with the namefield-nameand binds accessor and mutator procedures toaccessor-nameandmutator-name, respectively(immutable field-name), which specifies an immutable field with the namefield-name; an accessor procedure for it will be created and named by appending record name andfield-namewith a hyphen separator(mutable field-name), which specifies a mutable field with the namefield-name; an accessor procedure for it will be created and named as described above; a mutator procedure will also be created and named by appending-set!to the accessor namefield-name, which specifies an immutable field with the namefield-name; an access procedure for it will be created and named as described above
(parent parent-name), whereparent-nameis a symbol giving the name of the record type to be used as the parent of the new record type(protocol expression), whereexpressionevaluates to a protocol procedure which behaves as described above, and is used to create a record constructor descriptor for the new record type(sealed sealed?), wheresealed?is a boolean value that specifies whether or not the new record type is sealed(opaque opaque?), whereopaque?is a boolean value that specifies whether or not the new record type is opaque(nongenerative [uid]), which specifies that the record type is nongenerative via the optional uiduid. Ifuidis not specified, a unique uid will be generated at expansion time(parent-rtd parent-rtd parent-cd), a more explicit form of theparentform above;parent-rtdandparent-cdshould evaluate to a record-type descriptor and a record constructor descriptor, respectively
Scheme Syntax: record-type-descriptor record-name
Evaluates to the record-type descriptor associated with the type specified by record-name.
Scheme Syntax: record-constructor-descriptor record-name
Evaluates to the record-constructor descriptor associated with the type specified by record-name.