Unfortunately, your definition is broken. You just defined and, not aand. What you miss in aand is that it is bound to the previously-evaluated clause, so we have
(mac and args
" Evaluates arguments till false is found else returns the last one.
See also [[or]] [[aand]] [[andf]] [[andmap]] "
(if args
(if (cdr args)
`(if ,(car args) (and ,@(cdr args)))
(car args))
't))
, which is roughly equivalent to your aand.
Also, a formatting tip: surround code by two blank lines and indent it to get it to format properly.
Ack, OK somehow I didn't even think to read the definition of and before. Now I can see how my definition is basically equivalent.
I noticed it being bound in aand before but wasn't sure why. Your example of applying prn seems useful but are there any other common similar idioms? Thanks for the reply.
Well, you can write (aand (complex-expression 'that (might return) "nil") (frobnicate it)), but I can't think of any specific examples off the top of my head. There's also aif and awhen, which do similar things, and which are probably slightly more useful.