| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
7.5.3.2 Predicates
The procedures in this section test specific properties of lists.
- Scheme Procedure: proper-list? obj
Return
#tif obj is a proper list, or#fotherwise. This is the same as the corelist?(see section List Predicates).A proper list is a list which ends with the empty list
()in the usual way. The empty list()itself is a proper list too.(proper-list? '(1 2 3)) ⇒ #t (proper-list? '()) ⇒ #t
- Scheme Procedure: circular-list? obj
Return
#tif obj is a circular list, or#fotherwise.A circular list is a list where at some point the
cdrrefers back to a previous pair in the list (either the start or some later point), so that following thecdrs takes you around in a circle, with no end.(define x (list 1 2 3 4)) (set-cdr! (last-pair x) (cddr x)) x ⇒ (1 2 3 4 3 4 3 4 ...) (circular-list? x) ⇒ #t
- Scheme Procedure: dotted-list? obj
Return
#tif obj is a dotted list, or#fotherwise.A dotted list is a list where the
cdrof the last pair is not the empty list(). Any non-pair obj is also considered a dotted list, with length zero.(dotted-list? '(1 2 . 3)) ⇒ #t (dotted-list? 99) ⇒ #t
It will be noted that any Scheme object passes exactly one of the
above three tests proper-list?, circular-list? and
dotted-list?. Non-lists are dotted-list?, finite lists
are either proper-list? or dotted-list?, and infinite
lists are circular-list?.
- Scheme Procedure: null-list? lst
Return
#tif lst is the empty list(),#fotherwise. If something else than a proper or circular list is passed as lst, an error is signalled. This procedure is recommended for checking for the end of a list in contexts where dotted lists are not allowed.
- Scheme Procedure: not-pair? obj
Return
#tis obj is not a pair,#fotherwise. This is shorthand notation(not (pair? obj))and is supposed to be used for end-of-list checking in contexts where dotted lists are allowed.
- Scheme Procedure: list= elt= list1 …
Return
#tif all argument lists are equal,#fotherwise. List equality is determined by testing whether all lists have the same length and the corresponding elements are equal in the sense of the equality predicate elt=. If no or only one list is given,#tis returned.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 20, 2013 using texi2html 5.0.
