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 select/3 build-in predicate #48

Closed
s-webber opened this issue Jun 22, 2014 · 0 comments
Closed

add select/3 build-in predicate #48

s-webber opened this issue Jun 22, 2014 · 0 comments
Assignees

Comments

@s-webber
Copy link
Owner

Attempts to unify the third argument with the result of removing one instance of first argument from the list represented by the second argument.

Examples:

?- select(X,[h,e,l,l,o],Z).
X = h,
Z = [e, l, l, o] ;
X = e,
Z = [h, l, l, o] ;
X = l,
Z = [h, e, l, o] ;
X = l,
Z = [h, e, l, o] ;
X = o,
Z = [h, e, l, l] ;

?- select(l,[h,e,l,l,o],Z).
Z = [h, e, l, o] ;
Z = [h, e, l, o] ;
false.

?- select(l,[h,e,l,l,o],[h,e,l,o]).
true ;
true ;
false.

?- select(p(a,B),[p(X,q), p(a,X)],Z).
B = q,
X = a,
Z = [p(a, a)] ;
B = X,
Z = [p(X, q)] ;
false.
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