[plt-scheme] Macros that expand to macro definitions

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Tue Jul 26 16:17:18 EDT 2005

Arjun Guha wrote:
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> This (contrived) example doesn't work:
> 
>   (define-syntax (foo stx)
>     (syntax-case stx ()
>       [(_ foo-expr ...)
>        #`(begin
> 
>            (define-syntax (bar stx)
>              (syntax-case stx ()
>                [(_ (bar-expr ...))
>                 #'(begin
>                     (printf "~a~n" 'bar-expr) ...)]))
> 
>            (bar foo-expr) ...)]))
> 
> I get:
> 
> Welcome to DrScheme, version 299.106-svn16jun2005.
> Language: (module ...).
> syntax: no pattern variables before ellipses in template in: ...
> 
>>
> 
> However, if I remove the ellipses, so that the pattern for the inner bar 
> macro is (_ (bar-expr)), it works just fine.  Is there any way to use 
> ... in bar?

You need to write them as (... ...).

-- 
Jens Axel Søgaard



Posted on the users mailing list.