ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  1 Introduction   1.4 Definitions   1.4.1 Notational Conventions   1.4.1.4 Objects with Multiple Notations

1.4.1.4.4 NIL

nil has a variety of meanings. It is a symbol in the common-lisp package with the name "NIL", it is boolean (and generalized boolean) false, it is the empty list, and it is the name of the empty type (a subtype of all types).

Within Common Lisp, nil can be notated interchangeably as either NIL or (). By convention, the choice of notation offers a hint as to which of its many roles it is playing.

Notations for NIL
For Evaluation? Notation Typically Implied Role
Yes nil use as a boolean.
Yes 'nil use as a symbol.
Yes '() use as an empty list
No nil use as a symbol or boolean.
No () use as an empty list.

Within this document only, nil is also sometimes notated as false to emphasize its role as a boolean.

For example:

 (print ())                          ;avoided
 (defun three nil 3)                 ;avoided 
 '(nil nil)                          ;list of two symbols
 '(() ())                            ;list of empty lists
 (defun three () 3)                  ;Emphasize empty parameter list.
 (append '() '())  ()              ;Emphasize use of empty lists
 (not nil)  true                   ;Emphasize use as Boolean false
 (get 'nil 'color)                   ;Emphasize use as a symbol

A function is sometimes said to "be false" or "be true" in some circumstance. Since no function object can be the same as nil  and all function objects represent true when viewed as booleans, it would be meaningless to say that the function was literally false and uninteresting to say that it was literally true. Instead, these phrases are just traditional alternative ways of saying that the function "returns false" or "returns true," respectively.


Home Previous Up Next Table of Contents Index
© Franz Inc. 1998-2015 - File last updated 03-23-2015