Calling the make-record-type
procedure creates a new record data
type at run-time, without any compile-time support.
It is primarily provided for compatibility; in most cases it is better
to use the define-record-type
form (see Record types).
Procedure: make-record-type
type-name
field-names
Returns a record-type descriptor, a value representing a new data type disjoint from all others. The
type-name
argument must be a string, but is only used for debugging purposes (such as the printed representation of a record of the new type). Thefield-names
argument is a list of symbols naming the fields of a record of the new type. It is an error if the list contains any duplicates.
Procedure: record-constructor
rtd
[field-names
]
Returns a procedure for constructing new members of the type represented by
rtd
. The returned procedure accepts exactly as many arguments as there are symbols in the given list,field-names
; these are used, in order, as the initial values of those fields in a new record, which is returned by the constructor procedure. The values of any fields not named in that list are unspecified. Thefield-names
argument defaults to the list of field names in the call tomake-record-type
that created the type represented byrtd
; if thefield-names
argument is provided, it is an error if it contains any duplicates or any symbols not in the default list.
Procedure: record-predicate
rtd
Returns a procedure for testing membership in the type represented by
rtd
. The returned procedure accepts exactly one argument and returns a true value if the argument is a member of the indicated record type; it returns a false value otherwise.
Procedure: record-accessor
rtd
field-name
Returns a procedure for reading the value of a particular field of a member of the type represented by
rtd
. The returned procedure accepts exactly one argument which must be a record of the appropriate type; it returns the current value of the field named by the symbolfield-name
in that record. The symbolfield-name
must be a member of the list of field-names in the call tomake-record-type
that created the type represented byrtd
.
Procedure: record-modifier
rtd
field-name
Returns a procedure for writing the value of a particular field of a member of the type represented by
rtd
. The returned procedure accepts exactly two arguments: first, a record of the appropriate type, and second, an arbitrary Scheme value; it modifies the field named by the symbolfield-name
in that record to contain the given value. The returned value of the modifier procedure is unspecified. The symbolfield-name
must be a member of the list of field-names in the call tomake-record-type
that created the type represented byrtd
.
Returns a true value if
obj
is a record of any type and a false value otherwise.
Procedure: record-type-descriptor
record
Returns a record-type descriptor representing the type of the given record. That is, for example, if the returned descriptor were passed to
record-predicate
, the resulting predicate would return a true value when passed the given record.
Procedure: record-type-name
rtd
Returns the type-name associated with the type represented by rtd. The returned value is
eqv?
to thetype-name
argument given in the call tomake-record-type
that created the type represented byrtd
.
Procedure: record-type-field-names
rtd
Returns a list of the symbols naming the fields in members of the type represented by
rtd
. The returned value isequal?
to the field-names argument given in the call tomake-record-type
that created the type represented byrtd
.
Records are extensions of the class Record
.
These procedures use the Java 1.1 reflection facility.