define-struct

[syntax] define-struct name field ...

Bigloo, STklos: defines a structure with fields. The following related procedures are defined by this macro.

  • Constructor: make-name
  • Predicate: name?
  • Field accessor: name-field
  • Field modifier: name-field-set! (STklos doesn't define this; you can use set! with accessor to set the field value).

In STklos, struct instance can also be created by make-struct.

See also struct?, define-record-type.

[syntax] define-struct name (field ...) [inspector-expr]

[syntax] define-struct (name parent) (field ...) [inspector-expr]

MzScheme: defines a structure name with fields. The following related objects are defined by this macro.

  • Type destriptor: struct:name
  • Constructor: make-name
  • Predicate: name?
  • Field accessor: name-field
  • Field modifier: set-name-field!
  • Syntax (to be used in match form): name

The second form allows to make a structure name as a subtype of parent.

MzScheme also has let-struct to create local structures, make-struct-type to create structures procedurally.

 berkeley