syntax
( struct-copy idstruct-exprfld-id...)
fld-id = [field-idexpr]| [field-id#:parentparent-idexpr]
The id must have a transformer binding that encapsulates information about a structure type (i.e., like the initial identifier bound by struct ), and the binding must supply a constructor, a predicate, and all field accessors.
Each field-id must correspond to a field-id in the structure type defining forms of id (or parent-id, if present). The accessor bindings determined by different field-ids under the same id (or parent-id, if present) must be distinct. The order of the field-ids need not match the order of the corresponding fields in the structure type.
The struct-expr is evaluated first. The result must be an instance of the id structure type, otherwise the exn:fail:contract exception is raised. Next, the field exprs are evaluated in order (even if the fields that correspond to the field-ids are in a different order). Finally, the new structure instance is created.
The result of struct-expr can be an instance of a sub-type of id, but the resulting copy is an immediate instance of id (not the sub-type).
[color'blue]))> dory(fish 'blue 11)
> chum(shark 'grey 90 0)
;subtypes can be copied as if they were supertypes,;but the result is an instance of the supertype> not-really-chum(fish 'grey 90)