The standard boolean objects for true and false are written as
Alternatively, they may be written
What really matters,
though, are the objects that the Scheme conditional expressions (
treat as true or
false. The phrase “a true value” (or sometimes just “true”)
means any object treated as true by the conditional expressions, and the phrase “a false value” (or “false”) means any
object treated as false by the conditional expressions.
In this document,
test-expression is an expression that is evaluated,
but we only care about whether the result is a true or a false value.
Of all the standard Scheme values, only
#f counts as false in
conditional expressions. All other Scheme values, including
count as true. A
test-expression is an expression evaluated
in this manner for whether it is true or false.
In addition the null value
#!null (in Java written as
is also considered false. Also, if you for some strange reason create a
java.lang.Boolean object whose
false, that is also considered false.
Note: Unlike some other dialects of Lisp, Scheme distinguishes
#f and the empty list from each other and from the symbol
Boolean constants evaluate to themselves, so they do not need to be quoted in programs.
#t ⇒ #t #true ⇒ #t #f ⇒ #f #false ⇒ #f '#f ⇒ #f
The type of boolean values. As a type conversion, a true value is converted to
#t, while a false value is converted to
#f. Represented as a primitive Java
kawa.lang.Booleanwhen converted to an object.
#f, and returns
#fotherwise.(boolean? #f) ⇒ #t (boolean? 0) ⇒ #f (boolean? '()) ⇒ #f
#tif all the arguments are booleans and all are
#tor all are