[plt-scheme] Struggling with macro...

From: Robert Nikander (nikander at nc.rr.com)
Date: Wed May 23 11:21:41 EDT 2007

Robert Nikander wrote:
>       (let* ([sections (syntax->list #'(sexps ...))]
>              [adds (map (λ (section)
>                           (syntax-case section (variables thingies)
>                             ((variables (name value) ...)
>                              #'(begin (add-variable-to-mc mc 'name 
> value) ...))
>                             ((thingies expr ...)
>                              #'(begin (add-thingy-to-mc mc expr) ...))))
>                         sections)])


I should have used syntax-rules, for simplicity...


              [adds (map (syntax-rules (variables thingies)
                           ((variables (name value) ...)
                            (begin (add-variable-to-mc mc 'name value) ...))
                           ((thingies expr ...)
                            (begin (add-thingy-to-mc mc expr) ...)))
                         sections)])




Posted on the users mailing list.