[plt-scheme] How to create a macro that's in expression position?

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Mar 31 23:24:09 EST 2003

On Mar 31, Robby Findler wrote:
> 
> Sorry if that's disappointing!

It's an overkill even for something that does as little as it does,
but, it's still fun...

  > (module foo mzscheme
      (provide (all-from-except mzscheme #%app) (rename myapp #%app))
      (define-syntax (myapp stx)
        (syntax-case stx (+)
          ((_ x + y ...) #'(#%app + x y ...))
          ((_ x ...)     #'(#%app x ...)))))
  > (require foo)
  > (1 + 3)
  4

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


Posted on the users mailing list.