[racket] macro expansion function in Scheme

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jul 12 10:16:45 EDT 2011

8 minutes ago, Matthias Felleisen wrote:
> The following experiment produces a bit more insight: 
> > (((eval (expand '(m y))) #t) #f)
> #t
> The result of expand compiles to the correct closure. 
> So the docs for syntax->datum are dead serious when they say that it
> "returns a datum by stripping the lexical information, source
> location information, properties, and tamper status from stx."

Try also the macro stepper.  From an upcoming package for the repl:

  -> (define-syntax m
       (syntax-rules ()
         ((_ x)
          (lambda (x) (lambda (y) x)))))
  -> ,stx (m y) *
  syntax set
  Macro transformation
  (m y)
  (lambda:1 (y) (lambda:1 (y:1) y))

(But you'd usually want to use the gui version...)

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.