[plt-scheme] with-struct

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Wed Oct 21 15:27:45 EDT 2009

Noel Welsh wrote:
> On Wed, Oct 21, 2009 at 7:34 PM, Jon Rafkind <rafkind at cs.utah.edu> wrote:
>   
>> Here is a macro that introduces fields of a struct into the current lexical
>> environment so that instead of saying (foo-x some-foo) you can just say 'x',
>> similar to pascal's `with' construct.
>>     
>
> I use pattern matching in this situation:
>
> (match-define (struct foo x y) a-foo)
>
>   

Yes, my `with-struct' degenerates to match if the user lists all the 
fields when using the macro and also if set! is not provided.


Posted on the users mailing list.