[plt-scheme] How best to iterate arguments to a macro?

From: Grant Rettke (grettke at acm.org)
Date: Sun Oct 21 21:18:33 EDT 2007

On 10/20/07, Chongkai Zhu <czhu at cs.utah.edu> wrote:
> Your solution is OK.
>
> If you don't want to have recursive macro expanding, here's another solution:
>
> (define-syntax (property stx)
>   (syntax-case stx ()
>     ((property)
>      (raise-syntax-error 'property "Please provide at least one name"
> '{property ?}))
>     ((_ name ...)
>      (with-syntax (((property-name ...)
>                     (generate-temporaries #'(name ...))))
>        #'(begin
>            (define property-name null) ...
>            (define/public name
>              (case-lambda
>                [() property-name]
>                [(value) (set! property-name value)]))
>            ...)))))

In the recursive version I want to add checking that each argument is
an identifier and the argument names are unique. What is the best way
to go about this with the example you have provided?


Posted on the users mailing list.