Skip to content

Instantly share code, notes, and snippets.

@trietptm
Created December 10, 2012 13:26
Show Gist options
  • Save trietptm/4250545 to your computer and use it in GitHub Desktop.
Save trietptm/4250545 to your computer and use it in GitHub Desktop.
member(X,L), which holds iff the element X occurs in L
member_list(X, [X]).
member_list(X, [X|T]).
member_list(X, [H|T]) :- member_list(X, T).
@trietptm
Copy link
Author

One line Prolog function: member_list(X, [H|T]) :- X=H;member_list(X, T).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment