PLOGHELP MEMBER                              Robert Duncan, January 1988


    :- library(useful).

    ?- member(Item, List).


This goal succeeds whenever Item occurs in the list List (i.e when Item
is a member of List).

Such a goal can be used in one of two ways. With Item instantiated it
serves as a test of membership, as in

    ?- member(blue, [red, blue, green]).
    yes

If Item is not instantiated, then the goal will generate successive
members of List. For example:

    ?- member(Colour, [red, blue, green]).
    Colour = red ? ;
    Colour = blue ? ;
    Colour = green ? ;
    no

In either case, List should be instantiated to a proper list.


member/2 is a library predicate defined in LIBRARY USEFUL. Its
definition is:

    member(Item, [Item|_]).
    member(Item, [_|Items]) :-
        member(Item, Items).


-- RELATED DOCUMENTATION ----------------------------------------------

PLOGHELP * LIBRARY
    How to use the library mechanism.

PLOGHELP * USEFUL
    A library of useful predicates.

--- C.all/plog/help/member ---------------------------------------------
--- Copyright University of Sussex 1988. All rights reserved. ----------
