This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: macro defining macros


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]