Next: , Up: Truth   [Contents][Index]


16.4.5.1 True and False

In Common Lisp, the symbol ‘t’ is the default representation for truth. Like ‘nil’, ‘t’ evaluates to itself. The function listp returns true if its argumentis a list:

> (listp ’(a b c))
T

Predicate

A function whose return value is intended to be interpreted as truth or falsity is called a predicate. Common Lisp predicates often have names that end with ‘p’.

Falsity in Common Lisp is represented by ‘NIL’, the empty list. If we give listp an argument that isn’t a list, it returns ‘NIL’:

> (listp 27)
NIL

Although ‘t’ is the default representation for truth, everything except ‘NIL’ also counts as true in a logical context.