Subject: Problems with ONEARGCHECK and TWOARGCHECK
From: Richard Fateman
Date: Sat, 26 Jul 2008 07:31:09 -0700
oops.. some bugs there... I think it should be... assuming first arg x is a
symbol..
(defmacro unlesslength2(x res)`(if (and ,x (cdr ,x)(not (cddr ,x)))nil
,res))
a more elaborate macro definition, to be "hygienic" about the first argument
would
be something like
(defmacro unlesslength2(x res)
(let((h (gensym)))
`(let((,h ,x))
(if (and ,h (cdr ,h)(not(cddr ,h))) nil ,res))))
a good compiler will not allocate more memory than necessary.
To seem what this looks like, try
(macroexpand '(unlesslength2 '(a b) foo))
RJF