3.10 Boolean Functions and Conditionals

AND([U:any]):extra-boolean noeval, nospread
 
AND evaluates each U until a value of NIL is found or the end of the list is encountered. If a non-NIL value is the last value it is returned, or NIL is returned.
FEXPR PROCEDURE AND(U);

BEGIN

  IF NULL U THEN RETURN NIL;

LOOP: IF NULL CDR U THEN RETURN EVAL CAR U

ELSE IF NULL EVAL CAR U THEN RETURN NIL;

   U := CDR U;

GO LOOP

END;

COND([U:cond-form]):any noeval, nospread
 
The antecedents of all U’s are evaluated in order of their appearance until a non-NIL value is encountered. The consequent of the selected U is evaluated and becomes the value of the COND. The consequent may also contain the special functions GO and RETURN subject to the restraints given for these functions in “Program Feature Functions”, section 3.7 on page 39. In these cases COND does not have a defined value, but rather an effect. If no antecedent is non-NIL the value of COND is NIL. An error is detected if a U is improperly formed:

***** Improper cond-form as argument of COND

NOT(U:any):boolean eval, spread
 
If U is NIL, return T else return NIL (same as function NULL).
EXPR PROCEDURE NOT(U);

  U EQ NIL;

OR([U:any]):extra-boolean noeval, nospread
 
U is any number of expressions which are evaluated in order of their appearance. When one is found to be non-NIL it is returned as the value of OR. If all are NIL, NIL is returned.
FEXPR PROCEDURE OR(U);

BEGIN SCALAR X;

LOOP: IF NULL U THEN RETURN NIL

ELSE IF (X := EVAL CAR U) THEN RETURN X;

   U := CDR U;

GO LOOP

END;