memberchk(+Element, +List)In the previous section, it was pointed out that member(e, [s,e,e,n])
succeeds twice.
If you have a ground term (or
one that is sufficiently instantiated) and you only want to know
whether it occurs in a list or not, you would like the membership test
to succeed only once. memberchk/2 is a version of member/2 that does this.
memberchk(Element, List) can only be used to test whether a known
element occurs in a known list. It cannot be used to enumerate elements
of the list. memberchk/2 commits to the first match and does not backtrack.
Use memberchk/2 in preference to member/2, but only where its
restrictions are appropriate.