next up previous
Next: 3.3 Predicates and Truth Up: 3. EXTENSION OF THE Previous: 3.1 Functional Arguments

3.2 Logical Connectives

The logical or Boolian connectives are usually considered as primitive operators. However, in LISP, they can be defined by using conditional expressions:

$p\land q={[}p\rightarrow q;T\rightarrow F{]}$ $p\lor q={[}p\rightarrow T;T\rightarrow q{]}$ $\lnot q={[}q\rightarrow F;T\rightarrow T{]}$

In the System, not is a predicate of one argument. However, and and or are predicates of an indefinite number of arguments, and therefore are special forms. In writing M-expressions it is often convenient to use infix notation and write expressions such as aVbVc for or[a;b;c]. In S-expressions, one must, of course, use prefix notatlon and write (OR A B C).

The order in which the arguments of and and or are given may be of some significance in the case in which some of the arguments may not be well defined. The definitions of hese predicated given above show that the value may be defined even if all of the arguments are not.

and evaluates its arguments from left to right. If one of them is found that is false, then the value of the and is false and no further arguments are evaluated. If the arguments are all evaluated and found to be true, then the value is true.

or evaluates its arguments from left to right. If one of them is true, then the value of the or is true and no further arguments are evaluated. If the arguments are all evaluated and found to be false, then the value is false.


next up previous
Next: 3.3 Predicates and Truth Up: 3. EXTENSION OF THE Previous: 3.1 Functional Arguments