Node: Using Lists as Sets, Next: , Previous: List operations, Up: Lists

Using Lists as Sets

member item list Function

member item list test Function

member searches the list list for an object eql to the Lpp object item. If none is found nil is returned otherwise the tail of list beginning with the element eql to item is returned. list is searched at the top level only. Note that member can also be used as a predicate.

If the optional argument test is given it must be an Lpp Function object of two arguments that performs the test in place of eql.

For example:

     member(L(2), list(L(1), L(2), L(3))) => (2 3)
     member(L(2), list(S(one), S(two), L(three))) => nil
     let snums = listSEM("1", "2", "3", EM);
     member(L("2"), snums) => nil
     member(L("2"), snums, L(stringEqual)) => ("2", "3")