[LOGIC-81] predc constraint is not enforced when it could be Created: 19/Dec/12 Updated: 20/Dec/12 Resolved: 20/Dec/12 |
|
| Status: | Resolved |
| Project: | core.logic |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Nada Amin | Assignee: | David Nolen |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
The predc number constraint fails to be enforced here. (is (= (run* [q]
(fresh [x]
(== q x)
(predc q number? `number?)
(== x "foo")))
())) ;; false -- actual is ((_0 :- number?))
Inverting the first two goals gives the expected result. (is (= (run* [q]
(fresh [x]
(predc q number? `number?)
(== q x)
(== x "foo")))
())) ;; OK
|
| Comments |
| Comment by Nada Amin [ 19/Dec/12 9:12 AM ] |
|
Actually, the problem is not specific to predc. It's an issue that addcg can overwrite a precious binding. Here is another example without predc: (is (= (run* [q]
(fresh [x y z]
(== q x)
(distinctfd [q y])
(== y x)
(infd q x y (interval 1 3))))
()) ;; false -- actual is [1 2 3]
I have a fix that I'll submit shortly. |
| Comment by Nada Amin [ 19/Dec/12 9:20 AM ] |
|
Let's discuss on GitHub first: https://github.com/namin/core.logic/compare/logic-81 |
| Comment by Nada Amin [ 20/Dec/12 9:25 AM ] |
|
logic-81.diff include fix and tests. Since the interface for the constraint store has been modified, some tests needed to be udpated. discussion: https://github.com/clojure/core.logic/pull/14 rebase: |
| Comment by David Nolen [ 20/Dec/12 9:43 AM ] |
|
fixed, http://github.com/clojure/core.logic/commit/0f7de6ed7125df65f4450d5507341a98b151001a |