Records The Record package provides a facility for user to define their own record data types. defun make-record-type type-name field-names Returns a dfn{record-type descriptor}, a value representing a new data type disjoint from all others. The var{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). The var{field-names} argument is a list of symbols naming the dfn{fields} of a record of the new type. It is an error if the list contains any duplicates. It is unspecified how record-type descriptors are represented. defun make-record-sub-type type-name field-names rtd Returns a dfn{record-type descriptor}, a value representing a new data type, disjoint from all others. The var{type-name} argument must be a string. The var{field-names} argument is a list of symbols naming the additional dfn{fields} to be appended to var{field-names} of var{rtd}. It is an error if the combinded list contains any duplicates. Record-modifiers and record-accessors for var{rtd} work for the new record-sub-type as well. But record-modifiers and record-accessors for the new record-sub-type will not neccessarily work for var{rtd}. defun record-constructor rtd [field-names] Returns a procedure for constructing new members of the type represented by var{rtd}. The returned procedure accepts exactly as many arguments as there are symbols in the given list, var{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. The var{field-names} argument defaults to the list of field names in the call to code{make-record-type} that created the type represented by var{rtd}; if the var{field-names} argument is provided, it is an error if it contains any duplicates or any symbols not in the default list. defun record-predicate rtd Returns a procedure for testing membership in the type represented by var{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. defun record-sub-predicate rtd Returns a procedure for testing membership in the type represented by var{rtd} or its parents. The returned procedure accepts exactly one argument and returns a true value if the argument is a member of the indicated record type or its parents; it returns a false value otherwise. defun record-accessor rtd field-name Returns a procedure for reading the value of a particular field of a member of the type represented by var{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 symbol var{field-name} in that record. The symbol var{field-name} must be a member of the list of field-names in the call to code{make-record-type} that created the type represented by var{rtd}. defun record-modifier rtd field-name Returns a procedure for writing the value of a particular field of a member of the type represented by var{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 symbol var{field-name} in that record to contain the given value. The returned value of the modifier procedure is unspecified. The symbol var{field-name} must be a member of the list of field-names in the call to code{make-record-type} that created the type represented by var{rtd}. defun record? obj Returns a true value if var{obj} is a record of any type and a false value otherwise. Note that code{record?} may be true of any Scheme value; of course, if it returns true for some particular value, then code{record-type-descriptor} is applicable to that value and returns an appropriate descriptor. defun 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 code{record-predicate}, the resulting predicate would return a true value when passed the given record. Note that it is not necessarily the case that the returned descriptor is the one that was passed to code{record-constructor} in the call that created the constructor procedure that created the given record. defun record-type-name rtd Returns the type-name associated with the type represented by rtd. The returned value is code{eqv?} to the var{type-name} argument given in the call to code{make-record-type} that created the type represented by var{rtd}. defun record-type-field-names rtd Returns a list of the symbols naming the fields in members of the type represented by var{rtd}. The returned value is code{equal?} to the field-names argument given in the call to code{make-record-type} that created the type represented by var{rtd}.