COND
is an unusual function which may take any arbitrary
number of arguments. Each argument is called a clause, and
consists of a list of exactly two S-expressions. We will call the
first S-expression in a clause a condition, and the second
S-expression a result. Thus, a call to COND
looks
like this:
The value returned by(COND (
condition1 result1) (
condition2 result2) . . .
(T resultN ) )
COND
is computed as follows: if
condition1 is true (not NIL
), then return
result1; else if condition2 is true then return
result2; else if ...; else return resultN. In most LISP
systems, it is an error if none of the conditions are true, and the
result of the COND
is undefined. For this reason,
T
is usually used as the final condition.