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

From: Rouben Rostamian (rostamian at umbc.edu)
Date: Fri Aug 17 04:20:55 EDT 2012

No, not really.  I am looking for structures a la Common Lisp,
as described in the example that I gave.  The essential feature
there is that the constructor may receive the structure's fields
in any order.  There is no ambiguity because each field value
is associated with field tag.

I think I should be able to come up with a reverse-engineered
version of that in Racket but I don't want to reinvent the wheel
if it already exists.

-- rr

On Thu, Aug 16, 2012 at 10:44:08PM -0600, Richard Cleis wrote:
> 
> Are you asking for stuff like this?
> 
> http://docs.racket-lang.org/reference/define-struct.html
> 
> 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.