Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add memberchk/2 built-in predicate #8

Closed
s-webber opened this issue Mar 31, 2014 · 0 comments
Closed

add memberchk/2 built-in predicate #8

s-webber opened this issue Mar 31, 2014 · 0 comments
Assignees

Comments

@s-webber
Copy link
Owner

memberchk(X, Y) returns true if X is an element of the list Y

(Unlike "member(X, Y)", no attempt is made to re-evaluate during backtracking.)

Example use:

?- memberchk(a,[a,b,c]).
true.

?- memberchk(b,[a,b,c]).
true.

?- memberchk(c,[a,b,c]).
true.

?- memberchk(d,[a,b,c]).
false.

?- memberchk(a,[a,b,a,c]).
true.

?- memberchk(X,[a,b,a,c]).
X = a.
@s-webber s-webber self-assigned this Mar 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant