Boolean Operators
The list of boolean operators contains some logical redundancy. Logically only 'if' is required to
define the rest. However even ANSI C contains a version of the basic repertoire 'if', 'and', 'or', 'not' and the
'cond' is trivially compilable into a nested 'if'. Because Kλ does not contain macros and uses strict applicative
order evaluation outside boolean operations, these are not efficiently interdefinable in the language itself.
Note that in Kλ a 'cond' that fails in all its cases does not deliver NIL (as in CL) but an error.
Shen includes a 'cases' statement which has the syntax
(cases test-a result-a
test-b result-b
...............)
and which is equivalent to
(if test-a result-a (if test-b result-b ....))
If no cases apply an error is returned. |