[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

define-macro in v200



Hello.

Do I take it correctly that there is neither a define-macro or a
defmacro available by default in v200? Though the new syntax system is
admittedly Very Cool, lots of old code uses defmacro-style macros, so it
would be nice as a compatibility feature.

To get acquainted with the new syntax system, I tried to implement
define-macro. This is what I came up with:

(define-syntax (define-macro stx)
  (syntax-case stx ()
   ((_ (macro . args) . body)
    (syntax (define-macro macro (lambda args . body))))
   ((_ macro transformer)
    (syntax
     (define-syntax (macro stx2)
       (let ((v (syntax-object->datum stx2)))
         (datum->syntax-object 
          stx2
          (apply transformer (cdr v)))))))))

Does this look sensible?


Lauri Alanko
la@iki.fi