Example:


\begin{picture}(380,1)(0,0)
\put (0,0){\framebox{(}380,1)}
\end{picture}
      membchk(X,[X|_]) => true. 
      membchk(X,[_|Ys]) => membchk(X,Ys).
This predicate checks whether or not an element given as the first argument occurs in a list given as the second argument. The head of the first clause membchk(X,[X|_]) matches any call whose first argument is identical to the first element of the list. For instances, the calls membchk(a,[a]) and membchk(X,[X,Y]) succeed, and the calls membchk(a,Xs), membchk(a,[X]) and membchk(X,[a]) fail.
\begin{picture}(380,1)(0,0)
\put (0,0){\framebox{(}380,1)}
\end{picture}



Neng-Fa Zhou 2012-01-03