macro defining macros
Per Bothner
per@bothner.com
Sun Jun 26 23:13:00 GMT 2005
Robert Nikander wrote:
> Is there a way to escape the ellipsis so that you can write a macro
> that defines a macro? The "standard" is (... ...), but that doesn't
> appear to work.
I checked in an implementation for this. Please try it out.
> Here is a demo of the problem...
>
> ;; macro that creates another macro that quotes its arguments
> (define-syntax mac
> (lambda (x)
> (syntax-case x ()
> ((_ name)
> (syntax
> (define-syntax name
> (lambda (x)
> (syntax-case x ()
> ((_ e (... ...))
> (syntax (quote (e (... ...)))))))))))))
>
>
> (mac mac2)
> (mac2 (1 2 (3))) ----> '(1 2 (3))
Actually, it evaluates to: ((1 2 (3)))
(Petite Scheme yields the same result.)
--
--Per Bothner
per@bothner.com http://per.bothner.com/
More information about the Kawa
mailing list