Newsgroups: comp.lang.scheme
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!mintaka!bloom-beacon!dont-send-mail-to-path-lines
From: greg@vis.UUCP
Subject: Re: need macro-expand in mit-scheme
Message-ID: <9105300530.AA14930@ifsrad>
Sender: daemon@athena.mit.edu (Mr Background)
Organization: The Internet
References: <1991May26.121953.25102@cs.umn.edu>
Date: 30 May 91 05:30:42 GMT
Lines: 25

Since it may be of general interest, here it is:

 (define (macro-expand form)
   (define (macro-value x)
     (and (symbol? x) (syntax-table-ref (nearest-repl/syntax-table) x)) )
   (if (not (pair? form))
       form
       (let ( (m (macro-value (car form))) )
	 (if (procedure? m)
	     (macro-expand (apply m (cdr form)))
	     (map macro-expand form) ) ) ) )

I wrote it to get schelog working, but no longer need it as I'm
converting the original extend-syntax code to use define-macro.
As soon as I'm satisfied with the portability I'll send it to
the repository.

_Greg


J. Greg Davidson	Institute for Software Research and Development
+1 (619) 452-8059       6231 Branting Street  San Diego, CA  92122  USA
 
vis!greg@nosc.mil					ucsd----+--vis
vis!greg@ucsd.edu		 			nosc----|
