chickadee » srfi-1 » member

member x list #!optional =procedure

member is extended from its R5RS definition to allow the client to pass in an optional equality procedure = used to compare keys.

The comparison procedure is used to compare the elements E_I of LIST to the key X in this way:

(= X E_I) ; list is (E1 ... En)

That is, the first argument is always X, and the second argument is one of the list elements. Thus one can reliably find the first element of LIST that is greater than five with (member 5 LIST <)

Note that fully general list searching may be performed with the find-tail and find procedures, e.g.

(find-tail even? list) ; Find the first elt with an even key.