1% memberchk(+Element, +Set) 2% means the same thing, but may only be used to test whether a known 3% Element occurs in a known Set. In return for this limited use, it 4% is more efficient when it is applicable. 5 6lists:memberchk(X,[X|_]) :- !. 7lists:memberchk(X,[_|L]) :- 8 lists:memberchk(X,L). 9 10% member(?Element, ?Set) 11% is true when Set is a list, and Element occurs in it. It may be used 12% to test for an element or to enumerate all the elements by backtracking. 13% Indeed, it may be used to generate the Set! 14 15lists:member(X,[X|_]). 16lists:member(X,[_|L]) :- 17 lists:member(X,L). 18 19lists:append([], L, L). 20lists:append([H|T], L, [H|R]) :- 21 lists:append(T, L, R). 22 23 24 25