Re: Four problems with Scheme 48 1.8

Helmut Eller <[email protected]>
Newsgroups gmane.lisp.scheme.scheme48
Message-ID <[email protected]>
* Martin Ward [2009-07-15 11:40+0200] writes:

> I was hoping that there would be a simple way to define defmacro using
> define-syntax and syntax-rules, but I can't find one.

With explicit-renaming macros you could define defmacro as:

(define-syntax defmacro 
  (syntax-rules ()
    ((defmacro name args body ...)
     (define-syntax name 
       (lambda (form rename compare)
	 (apply (lambda args body ...)
		(cdr form)))))))

(defmacro when (test . body) `(cond (,test . ,body)))

Ignore the renaming junk and viola: defmacro.

Helmut
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.