In librep there is a single data value representing boolean
“false”—the empty list, written as
(). All other values are
considered “not-false”, i.e. “true”.
By convention the constants
t are used to
represent the canonical boolean values. The constant variable
nil evaluates to the empty list (i.e. “false”), while
evaluates to itself (i.e. not-“false”, therefore “true”).
Reiterating, all of the conditional operations regard anything
which is not
() as being true (i.e. non-false). The actual
t should be used where a true boolean value is explicitly
stated, to increase the clarity of the code.
(), and its alias
nil, represent both the empty list
and boolean falsehood. Most Lisp programmers write
() where its
value as a list should be emphasized, and
nil where its value as
boolean false is intended. Although neither of these values need be
quoted (see Quoting), most programmers will quote the empty list to
emphasize that it is a constant value. However
nil should not be
quoted, doing so would produce the symbol
boolean falsehood. For example:
(append '() '()) ⇒ () ;Emphasize use of empty lists (not nil) ⇒ t ;Emphasize use as boolean false (get 'nil 'color) ;Use the symbol
When a function is said to “return false”, it means that it returns the false boolean value, i.e. the empty list. When a function is said to “return true”, this means that any non-false value is returned.