[racket] Are there Racket structures similar to Common Lisp's?

From: Richard Cleis (rcleis at me.com)
Date: Fri Aug 17 00:44:08 EDT 2012

Are you asking for stuff like this?

http://docs.racket-lang.org/reference/define-struct.html

rac

On Aug 16, 2012, at 10:09 PM, Rouben Rostamian wrote:

> Is there the equivalent of Common Lisp's /structure/ type in
> Racket?  I looked through Racket's User Guide and Reference
> manuals but did not see something similar, although it's
> quite possible that I saw one but did not recognize it.
> 
> Specifically, here is what I want.  Consider the Common Lips
> definition of a /person/ structure:
> 
> (defstruct person
>           name
>           age
>           waist-size
>           favorite-color)
> 
> Then create an instance:
> 
> (make-person :age 35
>             :favorite-color "blue"
>             :name "Bob")
> 
> The latter echos:
> 
>  #S(PERSON :NAME "Bob" :AGE 35 :WAIST-SIZE NIL :FAVORITE-COLOR "blue")
> 
> Let's note that the order of fields when invoking /make-person/
> need not be the same as the order in which the /person/
> structure is defined.
> 
> Furthermore, since /waist-size/ was not specified at invocation,
> it was assigned NIL.
> 
> -- 
> Rouben Rostamian
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users


Posted on the users mailing list.