Next: mpg-ref-memberchk, Previous: mpg-ref-load_foreign_resource, Up: mpg-bpr [Contents][Index]
member/2
member(?Element, ?List)
is true if Element occurs in the List. It may be used to test for an element or to enumerate all the elements by backtracking. Indeed, it may be used to generate the List!
term
list of term
In the context of this predicate, a term occurs in a list if it can be unified with an element of the list.
On backtracking, an attempt is made to unify Element with successive elements of List. If List is not a proper list, then on backtracking it is unified with lists of ever increasing length.
| ?- member(foo(X), [foo(1), bar(2), foo(3)]). X = 1 ? ; X = 3 ? ; no
None.
ref-lte-acl,
library(lists)
.