[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[plt-scheme] define-structure question



The help desk entry for define-structure isn't clear to me, and an example 
would help.


(define-structure (name-identifier field ...))      SYNTAX

Like define-struct, except that the name-identifier is moved inside the 
parenthesis for fields. In addition, a field can be assigned a default 
value expression, in which case the constructor function does not consume 
an argument for the field.

A field has one of the following forms:

    field-identifier
    (field-identifier init-expr)

um, so like this:


 > (define-structure (bike saddle (forks 2)  (wheels 2)))
define-structure: bad syntax


nope...:(

This shows, of course, that even reading the manual won't help some people ;)

an example would be great... and a mapping of the example to the help desk 
entry would show me where my interpretation of the english in the help desk 
went wrong.

Dr. Chris Wright
Director, Intensive Care Unit
Monash Medical Centre
VIC 3168 AUSTRALIA