Node:SRFI-1 Searching, Next:, Previous:SRFI-1 Filtering and Partitioning, Up:SRFI-1



39.3.7 Searching

The procedures for searching elements in lists either accept a predicate or a comparison object for determining which elements are to be searched.

find pred lst Scheme Procedure
Return the first element of lst which satisfies the predicate pred and #f if no such element is found.

find-tail pred lst Scheme Procedure
Return the first pair of lst whose CAR satisfies the predicate pred and #f if no such element is found.

take-while pred lst Scheme Procedure
take-while! pred lst Scheme Procedure
Return the longest initial prefix of lst whose elements all satisfy the predicate pred.

take-while! is allowed, but not required to modify the input list while producing the result.

drop-while pred lst Scheme Procedure
Drop the longest initial prefix of lst whose elements all satisfy the predicate pred.

span pred lst Scheme Procedure
span! pred lst Scheme Procedure
break pred lst Scheme Procedure
break! pred lst Scheme Procedure
span splits the list lst into the longest initial prefix whose elements all satisfy the predicate pred, and the remaining tail. break inverts the sense of the predicate.

span! and break! are allowed, but not required to modify the structure of the input list lst in order to produce the result.

any pred lst1 lst2 ... Scheme Procedure
Apply pred across the lists and return a true value if the predicate returns true for any of the list elements(s); return #f otherwise. The true value returned is always the result of the first successful application of pred.

every pred lst1 lst2 ... Scheme Procedure
Apply pred across the lists and return a true value if the predicate returns true for every of the list elements(s); return #f otherwise. The true value returned is always the result of the final successful application of pred.

list-index pred lst1 lst2 ... Scheme Procedure
Return the index of the leftmost element that satisfies pred.

member x lst [=] Scheme Procedure
Return the first sublist of lst whose CAR is equal to x. If x does no appear in lst, return #f. Equality is determined by the equality predicate =, or equal? if = is not given.