Logical Expression Details
Recall that in Scheme the truth value false is represented as #f.
For the purposes of not, or, and and, the truth value
true is represented as any non-#f value (including #t).
- (not expr) evaluates to #t if expr
evaluates to #f and to #f if expr
evaluates to non-#f
- (or expr1 expr2 ... exprn) returns the
first non-#f value of an argument, or #f if no
argument evaluates to a non-#f value
- (and expr1 expr2 ... exprn) returns
#f if any of its arguments evaluate to #f, and the value of the
last argument if all arguments evaluate to non-#f values
Note that in the case of or and and, n can be
any nonnegative integer, that is, there can be as few as zero arguments.