Next: Cutting and Pasting Lists, Previous: Construction of Lists, Up: Lists

— procedure: **list?**` object`

Returns

`#t`

ifobjectis a list, otherwise returns`#f`

. By definition, all lists have finite length and are terminated by the empty list. This procedure returns an answer even for circular structures.Any

objectsatisfying this predicate will also satisfy exactly one of`pair?`

or`null?`

.(list? '(a b c)) => #t (list? '()) => #t (list? '(a . b)) => #f (let ((x (list 'a))) (set-cdr! x x) (list? x)) => #f

— procedure: **circular-list?**` object`

(SRFI 1) Returns

`#t`

ifobjectis a circular list, otherwise returns`#f`

.(dotted-list? (list 'a 'b 'c)) => #f (dotted-list? (cons* 'a 'b 'c)) => #t (dotted-list? (circular-list 'a 'b 'c)) => #f

— procedure: **dotted-list?**` object`

(SRFI 1) Returns

`#t`

ifobjectis an improper list, otherwise returns`#f`

.(circular-list? (list 'a 'b 'c)) => #f (circular-list? (cons* 'a 'b 'c)) => #f (circular-list? (circular-list 'a 'b 'c)) => #t

— procedure: **length**` list`

Returns the length of

list. Signals an error iflistisn't a proper list.(length '(a b c)) => 3 (length '(a (b) (c d e))) => 3 (length '()) => 0 (length (circular-list 'a 'b 'c)) error-->

— procedure: **length+**` clist`

(SRFI 1) Returns the length of

clist, if it is a proper list. Returns`#f`

ifclistis a circular list. Otherwise signals an error.(length+ (list 'a 'b 'c)) => 3 (length+ (cons* 'a 'b 'c)) error--> (length+ (circular-list 'a 'b 'c)) => #f

— procedure: **null?**` object`

Returns

`#t`

ifobjectis the empty list; otherwise returns`#f`

.(null? '(a . b)) => #f (null? '(a b c)) => #f (null? '()) => #t

— procedure: **list-ref**` list k`

Returns the

kth element oflist, using zero-origin indexing. The valid indexes of a list are the exact non-negative integers less than the length of the list. The first element of a list has index`0`

, the second has index`1`

, and so on.(list-ref '(a b c d) 2) => c (list-ref '(a b c d) (inexact->exact (round 1.8))) => c

`(list-ref`

listk`)`

is equivalent to`(car (list-tail`

listk`))`

.

— procedure: **first**` list`

— procedure:**second**` list`

— procedure:**third**` list`

— procedure:**fourth**` list`

— procedure:**fifth**` list`

— procedure:**sixth**` list`

— procedure:**seventh**` list`

— procedure:**eighth**` list`

— procedure:**ninth**` list`

— procedure:**tenth**` list`

— procedure:

— procedure:

— procedure:

— procedure:

— procedure:

— procedure:

— procedure:

— procedure:

— procedure:

Returns the specified element of

list. It is an error iflistis not long enough to contain the specified element (for example, if the argument to`seventh`

is a list that contains only six elements).