[racket] struct with default value per field

From: Patrick Useldinger (uselpa.list at gmail.com)
Date: Sat Jun 22 04:23:51 EDT 2013

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

Posted on the users mailing list.