# (lispref.info)List-related Predicates

Next: List Elements Prev: Lists as Boxes Up: Lists
```
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 tests 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 `t' if OBJECT is a cons cell, `nil'
otherwise.  `nil' is not a cons cell, although it *is* a list.

- Function: atom OBJECT
This function returns `t' if OBJECT is an atom, `nil' otherwise.
All objects except cons cells are atoms.  The symbol `nil' is an
atom and is also a list; it is the only Lisp object which is both.

(atom OBJECT) == (not (consp OBJECT))

- Function: listp OBJECT
This function returns `t' if OBJECT is a cons cell or `nil'.
Otherwise, it returns `nil'.

(listp '(1))
=> t
(listp '())
=> t

- Function: nlistp OBJECT
This function is the opposite of `listp': it returns `t' if OBJECT
is not a list.  Otherwise, it returns `nil'.

(listp OBJECT) == (not (nlistp OBJECT))

- Function: null OBJECT
This function returns `t' if OBJECT is `nil', and returns `nil'
otherwise.  This function is identical to `not', but as a matter
of clarity we use `null' when OBJECT is considered a list and
`not' when it is considered a truth value (see `not' in *Note
Combining Conditions::).

(null '(1))
=> nil
(null '())
=> t

```

automatically generated by info2www