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 an element that is given as the first argument occurs in a list that is 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 instance, 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 2013-01-25