[comp.lang.scheme] need macro-expand in mit-scheme

greg@vis.UUCP (05/30/91)

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----|