Vassil Nikolov <email@example.com> wrote:
| Andre Thieme <firstname.lastname@example.org> said:
| | say:
| | (when list
| | (code))
| | An IF that returns an empty list can be replaced with either
| | WHEN or with UNLESS.
| The usual approach is to use WHEN or UNLESS when evaluating for side
| effect; if the returned value will be used, IF is in order with both
| a "then" and an "else" expression.
Yes, but... even that rule has its exceptions. After all, the value
of WHEN when the test is false *is* well-defined in the CLHS to be NIL,
and I find that (for example) doing conditional splicing of optional
forms into backquoted macro bodies looks better done this way:
,@(when test (list form1 form2 ...))
or even this way if there's just one form
[though I still personally prefer using the WHEN]:
,@(and test (list form))
rather than this way:
,@(if test (list form1 form2 ...) nil)
YMMV, of course.
Rob Warnock <email@example.com>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607