[plt-scheme] A question on "expand"

From: Noel Welsh (noelwelsh at yahoo.com)
Date: Tue Nov 12 06:03:38 EST 2002

--- Chris Wright <caw at cs.mu.oz.au> wrote:
> I'm currently in the middle of getting macros all
> wrong;)
> So, I'm trying to "see what they look like" by using
> "expand"

[snip]

(require (lib "defmacro.ss"))

(define-macro t
  (lambda (args)
    `(apply + ,args)))

(syntax-object->datum (expand-once '(t (1 2))))

> (apply + (1 2))

Notes:
- expand-once produces more readable output than
expand
- defmacros suck; syntax-rules/syntax-case don't.

(define-syntax t
  (syntax-rules ()
    ((t args) (apply + args))))

(syntax-object->datum (expand-once '(t (1 2))))

> (apply + (1 2))

HTH,
Noel

__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2


Posted on the users mailing list.