Membership Testing

A list of items can be used to represent a set. The function (member x lst) tests whether the item x is a member of the list lst. If x is a member of lst, the value of member is the tail (a tail of a list is the result of applying cdr to it 0 or more times) of the list lst beginning with the place where x was found; otherwise, the value of member is #f.

(define club '(tom dick harry))

(member 'dick club) = (dick harry)

(member 'fred club) = #f

There are three member functions that use the different equality tests:

Contents    Page-10    Prev    Next    Page+10    Index