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

From: Grant Rettke (grettke at acm.org)
Date: Sat Oct 20 19:49:11 EDT 2007

I wanted a macro to declare class level properties and came up with
the macro 'property'. Its applications looks like this:

(define service-call%
  (class* object% ()
    (property customer-name customer-id call-type-code date-of-call-string)

Working on this I wasn't sure whether to use variable arguments or
ellipses to specify the pattern. I ended up using ellipses. Is it even
possible to iterate using variable arguments?

My question for everyone is in cases like this, what is the best way
to iterate arguments when you are going to perform the same operation
on each argument?

Here is my solution:

(define-syntax property
  (syntax-rules ()
    ((_) (raise-syntax-error 'property "Please provide at least one
name" '{property ?}))
    ((_ name)
       (define property-name null)
       (define/public name
           [() property-name]
           [(value) (set! property-name value)]))))
    ((_ name names ...)
       (property name)
       (property names ...)))))

Posted on the users mailing list.