Subject: Re: Lisp Syntax - functions versus data
From: (Rob Warnock)
Date: Tue, 27 Feb 2007 22:40:05 -0600
Newsgroups: comp.lang.lisp
Message-ID: <>
Vassil Nikolov  <> wrote:
| Andre Thieme <> 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			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607