tests whether a term is member of a list.
member/2 declares, that Term is a member of List. Different cases can be:
Term term List list
| member(b,[a,b,c]). | Succeeds. |
| member(X,[a,b]). | Succeeds twice with substitution
X <- a X <- b |
| member(a,X). | Succeeds infinitely with substitution
X <- [a|_1], X <- [_2,a|_3], X <- [_4,_5,a|_6],.... |
| member(X,Y). | Succeeds infinitely with substitution
X <- _1, Y <- [_1|_2], X <- _3, Y <- [_4,_3|_5], X <- _6, Y <- [_7,_8,_6|_9], ... |
This predicate is not part of the ISO-Prolog Standard.
| scroll to top |
|