[plt-scheme] Extending macro pattern syntax

From: James Coglan (jcoglan at googlemail.com)
Date: Sat Jan 31 15:30:27 EST 2009

>
> And in fact it already works in PLT Scheme:
>>
>> #lang scheme
>>
>> (define-syntax foo
>>  (syntax-rules ()
>>    [(foo a b ... c)
>>     '(a b ... c)]))
>
>

Also, I just noticed this does not work:

(define-syntax infix-ellip
  (syntax-rules ()
    [(_ (name value) ... fn ignore ...)
      (let ([name value] ...)
        (fn name ...))]))

mzscheme complains of more than one ellipsis in the pattern (which I gather
is what R6RS mandates), but there's no reason I can see that this should not
be allowed to match, say, the following:

(infix-ellip (a 1) (b 2) * 5 'ignore)

Can macros be used to support this or is it impossible? Examples would be
great as I'm kinda new to all this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090131/52802726/attachment.html>

Posted on the users mailing list.