Created
December 10, 2012 13:26
-
-
Save trietptm/4250545 to your computer and use it in GitHub Desktop.
member(X,L), which holds iff the element X occurs in L
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
member_list(X, [X]). | |
member_list(X, [X|T]). | |
member_list(X, [H|T]) :- member_list(X, T). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One line Prolog function: member_list(X, [H|T]) :- X=H;member_list(X, T).