list? - check if an object is a list
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme base)) ;R7RS
is a list,
otherwise. By definition, all lists are chains of pairs that have
finite length and are terminated by the empty list.
This procedure is expected to run in time linear to the number of
elements in the list. Implementations can be expected to use an
algorithm like Floyd's cycle-finding algorithm ("tortoise and hare"),
which handles the case of circular lists created with
Returns a boolean object.
(list? '(a b c)) => #t
(list? '()) => #t
(list? '(a . b)) => #f
(let ((x (list 'a)))
(set-cdr! x x)
(list? x)) => #f
procedure is identical in all revisions of the Scheme reports. IEEE
Scheme explicitly mentions the case of circular structures.
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
The wrong number of arguments was passed.
The assertions described above are errors.
Implementations may signal an error, extend the procedure's
domain of definition to include such arguments,
or fail catastrophically.
procedure first appeared in R4RS.
This page is part of the
It includes materials from the RnRS documents.
More information can be found at
A fairly common mistake is to call
when destructuring an object, e.g. immediately before using
Markup created by unroff 1.0sc, March 04, 2023.