The boolean objects are true and false. The boolean constant true is written as ‘#t’, and the boolean constant false is written as ‘#f’.
The primary use for boolean objects is in the conditional expressions
if, cond, and, and or; the behavior of these
expressions is determined by whether objects are true or false. These
expressions count only #f as false. They count everything else,
including #t, pairs, symbols, numbers, strings, vectors, and
procedures as true (but see True and False).
Programmers accustomed to other dialects of Lisp should note that Scheme
distinguishes #f and the empty list from the symbol nil.
Similarly, #t is distinguished from the symbol t. In
fact, the boolean objects (and the empty list) are not symbols at all.
Boolean constants evaluate to themselves, so you don't need to quote them.
#t ⇒ #t
#f ⇒ #f
'#f ⇒ #f
t error--> Unbound variable
These variables are bound to the objects
#fand#trespectively. The compiler, given theusual-integrationsdeclaration, replaces references to these variables with their respective values.Note that the symbol
trueis not equivalent to#t, and the symbolfalseis not equivalent to#f.
Returns
#tif object is either#tor#f; otherwise returns#f.(boolean? #f) ⇒ #t (boolean? 0) ⇒ #f
These procedures return
#tif object is false; otherwise they return#f. In other words they invert boolean values. These two procedures have identical semantics; their names are different to give different connotations to the test.(not #t) ⇒ #f (not 3) ⇒ #f (not (list 3)) ⇒ #f (not #f) ⇒ #t
This predicate is true iff obj1 and obj2 are either both true or both false.