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

CLP(Z) - all_distinct/1 #38

Closed
infradig opened this issue Sep 11, 2022 · 1 comment
Closed

CLP(Z) - all_distinct/1 #38

infradig opened this issue Sep 11, 2022 · 1 comment

Comments

@infradig
Copy link
Contributor

Really just a progress note to self here:

~/trealla (devel) $ tpl ~/scryer-prolog/src/lib/clpz.pl
?- all_different([A,B]).
   clpz:all_different([A,B]),clpz:all_different([A,B]).
?- all_different([A,B]), A=1, B=1.
   false.

Ok, that's good.

?- all_distinct([A,B]).
   true.

Oops, not good, where are the residuals?

?- all_distinct([A,B]), A=1, B=1.
   A = 1, B = A.

They are really not there it seems. But freezing them first then they now appear...

?- freeze(A,true),freeze(B,true),all_distinct([A,B]).
   clpz:all_distinct([A,B]),freeze:freeze(A,true),clpz:all_distinct([A,B]),freeze:freeze(B,true).
?- freeze(A,true),freeze(B,true),all_distinct([A,B]),A=1,B=1.
   false.
?- freeze(A,true),freeze(B,true),all_distinct([A,B]),A=1,B=2.
   A = 1, B = 2.

Yes, that works. Very odd!

infradig added a commit that referenced this issue Sep 12, 2022
@infradig
Copy link
Contributor Author

Fixed.

~/trealla (devel) $ tpl ~/scryer-prolog/src/lib/clpz.pl
?- all_distinct([A,B]).
   clpz:all_distinct([A,B]).
?- all_distinct([A,B]), A=1,B=1.
   false.
?- all_distinct([A,B]), A=1,B=2.
   A = 1, B = 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant