Node:List Searching,
Next:List Mapping,
Previous:List Modification,
Up:Lists
22.2.7 List Searching
The following procedures search lists for particular elements. They use
different comparison predicates for comparing list elements with the
object to be searched. When they fail, they return #f
, otherwise
they return the sublist whose car is equal to the search object, where
equality depends on the equality predicate used.
memq x lst
|
Scheme Procedure |
scm_memq (x, lst)
|
C Function |
Return the first sublist of lst whose car is eq?
to x where the sublists of lst are the non-empty
lists returned by (list-tail lst k) for
k less than the length of lst. If x does not
occur in lst, then #f (not the empty list) is
returned.
|
memv x lst
|
Scheme Procedure |
scm_memv (x, lst)
|
C Function |
Return the first sublist of lst whose car is eqv?
to x where the sublists of lst are the non-empty
lists returned by (list-tail lst k) for
k less than the length of lst. If x does not
occur in lst, then #f (not the empty list) is
returned.
|
member x lst
|
Scheme Procedure |
scm_member (x, lst)
|
C Function |
Return the first sublist of lst whose car is
equal? to x where the sublists of lst are
the non-empty lists returned by (list-tail lst
k) for k less than the length of lst. If
x does not occur in lst, then #f (not the
empty list) is returned.
|