[racket] keyword initialization of structs?
Jay, Tom,
Thanks for the pointers. I tend to follow the one provided
by Tom (code written by Matthias Felleisen), as it suits my
needs. The sstruct module seems more powerful indeed, but
it does not work in modern Racket right away...
Best regards,
Dmitry
On 03/06/2012 12:20 AM, Jay McCarthy wrote:
> And something more powerful:
>
> https://github.com/jeapostrophe/exp/blob/master/sstruct-tests.ss
>
> Jay
>
> On 3/5/12, Tom McNulty<tom.mcnulty at gmail.com> wrote:
>> There's an example macro to do this here, although it'll only work for
>> structures you define.
>>
>> http://www.mail-archive.com/users@racket-lang.org/msg03392.html (See
>> Matthias' response)
>>
>> I recall this example quite well, as it was very helpful when I was learning
>> Racket macros.
>>
>>
>> On 2012-03-05, at 8:16 AM, Dmitry Pavlov wrote:
>>
>>> Hello,
>>>
>>> I was wondering if Racket's struct instances can be initialized
>>> with keywords, like in the following example written in CL:
>>>
>>>
>>> * (defstruct foo bar baz)
>>> FOO
>>>
>>> * (make-foo :bar 1 :baz 2)
>>> #S(FOO :BAR 1 :BAZ 2)
>>>
>>>
>>> Best regards,
>>>
>>> Dmitry
>>> ____________________
>>> Racket Users list:
>>> http://lists.racket-lang.org/users
>>
>>
>
>