Set as Linked List
A linked list can be used as a representation of a set. member (written ∈) tests whether a given item is an element of the list. member returns the remainder of the list beginning with the desired element, although usually member is used as a predicate to test whether the element is present or not.
(member 'dick '(tom dick harry)) -> (dick harry) (member 'fred '(tom dick harry)) -> nil
public static Cons member (Object item, Cons lst) { if ( lst == null ) return null; else if ( item.equals(first(lst)) ) return lst; else return member(item, rest(lst)); }
(defun member (item lst) (if (null lst) nil (if (eql item (first lst)) lst (member item (rest lst)) ) ) )