Hi

I can't find a way to have a per-field default value in a struct, such as in Common Lisp:

? (defstruct person (name "James" :type string) (age 1 :type number))
PERSON
? (defparameter p (make-person))
P
? p
#S(PERSON :NAME "James" :AGE 1)
? (defparameter p (make-person :name "Paul"))
P
? p
#S(PERSON :NAME "Paul" :AGE 1)
? (defparameter p (make-person :name "Paul" :age 10))
P
? p
#S(PERSON :NAME "Paul" :AGE 10)


The only thing I find is #:auto-value, which applies to all fields.

Is there a way to do the same in Racket? If not, is there a specific reason for this choice?

-pu
____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to