5.3 Predicates on Lists 
  The following predicates test whether a Lisp object is an atom, is a
cons cell or is a list, or whether it is the distinguished object
nil.  (Many of these predicates can be defined in terms of the
others, but they are used so often that it is worth having all of them.)
- Function: consp object
- This function returns tif object is a cons cell,nilotherwise.nilis not a cons cell, although it is a list.
- Function: atom object
- 
This function returns tif object is an atom,nilotherwise.  All objects except cons cells are atoms.  The symbolnilis an atom and is also a list; it is the only Lisp object
that is both.
 |  | (atom object) == (not (consp object))
 |  
 
- Function: listp object
- This function returns tif object is a cons cell ornil.  Otherwise, it returnsnil.
 |  | (listp '(1))
     => t
(listp '())
     => t
 |  
 
- Function: nlistp object
- This function is the opposite of listp: it returnstif
object is not a list.  Otherwise, it returnsnil.
 |  | (listp object) == (not (nlistp object))
 |  
 
- Function: null object
- This function returns tif object isnil, and
returnsnilotherwise.  This function is identical tonot,
but as a matter of clarity we usenullwhen object is
considered a list andnotwhen it is considered a truth value
(seenotin 10.3 Constructs for Combining Conditions).
 |  | (null '(1))
     => nil
(null '())
     => t
 |  
 
  
This document was generated
on May 2, 2002
using texi2html