[racket] structure question

From: Manfred Lotz (manfred.lotz at arcor.de)
Date: Wed Dec 8 00:51:18 EST 2010


On Wed, 08 Dec 2010 00:20:13 -0500
Neil Van Dyke <neil-iSOEUaFOKGKgBLj5vKMu3A at public.gmane.org> wrote:

> Manfred Lotz wrote at 12/07/2010 11:51 PM:
> [...]
> > (add-record (make-book :author "John Grisham" :title "The Client"))
> >
> > I like to use field names like in the example above. Can I do this
> > in racket?
> 
> What I have done most recently is to define a struct with a low-level 
> constructor with positional arguments, and then define a constructor 
> procedure with keyword arguments ultimately calls the low-level
> constructor.
> 
> There is often a need for a higher-level constructor anyway, such as
> for storing internal information in the struct or performing run-time
> checks.
> 
> But, if you wanted to, you could define a simple macro that defines a 
> struct constructor that accepts keyword arguments and simply stores 
> arguments to struct fields without checking or any other added
> behavior.
> 

Thanks, Neil. I understand that it is not available directly in Racket
but available through packages like yours which is fine for me.


-- 
Manfred


-- 
Manfred



Posted on the users mailing list.