

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).


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.

Figure 1-1. Notations for NIL


For example:

 (print ())                          ;avoided
 (defun three nil 3)                 ;avoided 
 '(nil nil)                          ;list of two symbols
 '(() ())                            ;list of empty lists
 (append '() '()) =>  ()              ;Emphasize use of empty lists
 (not nil) =>  true                   ;Emphasize use as Boolean false

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.

Copyright 1996-2005, LispWorks Ltd. All rights reserved.