Previous Up Next

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).

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           

Previous Up Next