### 6.4.2 Testing if a value is in a list or a set

The member and contains commands determine whether or not an object is in a list; the difference between them is the order of the arguments (required for compatibility reasons).

- member takes two arguments:
  - c, a value.
  - L, a list or a set.
- member(c,L) returns 0 if c is not an element of L and otherwise returns n if c is in L and its first position has index n−1. 0 if c is not in L.

- contains takes two arguments:
  - L, a list or a set.
  - c, a value.
- contains(L,c) returns 0 if c is not an element of L and otherwise returns n if c is in L and its first position has index n−1. 0 if c is not in L.

#### Examples

member(2,[0,1,2,3,4,2])

or:

member(2,%{0,1,2,3,4,2%})

or:

contains([0,1,2,3,4,2],2)

or:

contains(%{0,1,2,3,4,2%},2)

3 |  |  |  |  |  |  |  |  |  |