Macro Expansion: IF-N-Z-P
> (macroexpand '(if-n-z-p (* 3 -5) -35 'zero 37))
(IF (> -15 0) 37 (PRINT 'ERROR))))
Note that COND, which is implemented as a macro in GCL, was expanded, too.
The macro expansion for this macro is a little inefficient, because the condition 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. (We’ll return to this later.)