The 'listp' predicate function checks if the 'expr' is a list. T is returned if 'expr' is a list or an empty list [the NIL value], NIL is returned otherwise.
(listp '(a b)) ; returns T - list (listp nil) ; returns T - NIL (listp '(a . b)) ; returns T - dotted pair list (listp (lambda (x) (print x))) ; returns NIL - closure - lambda (listp #(1 2 3)) ; returns NIL - array (listp *standard-output*) ; returns NIL - stream (listp 1.2) ; returns NIL - float (listp #'quote) ; returns NIL - fsubr (listp 1) ; returns NIL - integer (listp object) ; returns NIL - object (listp "str") ; returns NIL - string (listp #'car) ; returns NIL - subr (listp 'a) ; returns NIL - symbol
Note: NIL or '() is used in many
places as a list-class or atom-class expression. Both
atom and 'listp', when applied to
See the
listp
function in the