Macro Expansion: IF-N-Z-P
> (macroexpand '(if-n-z-p (* 3 -5) -35 'zero 37))
Produces code approximately equivalent to:
(IF (> -15 0) 37 (PRINT 'ERROR))))
Note that COND, which is implemented as a macro in GCL, was expanded, too.
The macro expansion process for this macro is a little inefficient, because the numerical expression is always evaluated 3 times. We could rewrite the macro to perform the expansion once, save the value in a local variable, and access it three times. But, what should we name the variable?
The safe thing to do is use GENSYM to synthesize a unique symbol and use it. (An optional exercise - and fairly tricky).