Example: AVERAGE
Takes two numeric arguments and returns the mean.
> (define-macro (average num1 num2)
(list '/ (list '+ (eval num1) (eval num2))
> (macroexpand '(average 2 (* 5 4)))
or, in DrScheme (uses top-level env’t):
(#%app (#%top . /) (#%app (#%top . +) (#%datum . 2) (#%datum . 20)) (#%datum . 2))
Arguments to macros are not automatically evaluated, as they are in function calls.