- find pred clistprocedure
Return the first element of CLIST that satisfies predicate PRED; false if no element does.
(find even? '(3 1 4 1 5 9)) => 4
Note that find has an ambiguity in its lookup semantics -- if find returns #f, you cannot tell (in general) if it found a #f element that satisfied PRED, or if it did not find any element at all. In many situations, this ambiguity cannot arise -- either the list being searched is known not to contain any #f elements, or the list is guaranteed to have an element satisfying PRED. However, in cases where this ambiguity can arise, you should use find-tail instead of find -- find-tail has no such ambiguity:
(cond ((find-tail pred lis) => (lambda (pair) ...)) ; Handle (CAR PAIR) (else ...)) ; Search failed.