Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

listp

listp

type: predicate function (subr)
location: built-in
source file: xlbfun.c
Common LISP compatible: yes
supported on: all machines

SYNTAX

(listp <expr> )
        <expr>          -       the expression to check

DESCRIPTION

The LISTP predicate 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.

EXAMPLES

(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 NIL, return T. If you wish to check for a non-empty list, use the CONSP predicate.


Go to the first, previous, next, last section, table of contents.