cond
- (cond (EXPRESSION EXPRESSION) (EXPRESSION EXPRESSION) ...)
A cond clauses contains one or more branches. Each branch contains two expressions: a 'test' and a 'result.' The branches are considered in order. To evaluate a branch, first evaluate the test expression. If the test expression is true, then the result of the whole cond is the result of evaluating the result expression of this branch. If the result of evaluating the test expression is false, this branch is discarded and evaluation proceeds with the next branch. If the result of the test expression is neither true nor false, it is considered an error. If none of the test expressions evaluates to true, it is also an error. - (cond (EXPRESSION EXPRESSION) ... (else EXPRESSION))
This form of cond is similar to the prior one except that the final 'else' clause is always taken if no prior branch's test expression evaluates to true. In other words, there is no possibility that evaluation will 'fall off the end' of the branches.
Beginning Student Table of Contents