Details
-
Type:
Defect
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Declined
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Clojure 1.4.0 , core.logic 0.8.0-beta3
Description
When specifying domains on more than two lvars core.logic 0.8.0-beta3 throws an UnsupportedOperationException. Here's an example:
(run* [q]
(fresh [x y z]
(infd x y z (domain 1 2 3))
(<fd x y)
(<fd y z)
(== q [x y z])))
- 0.8.0-beta2: nil.
- 0.8.0-beta3: UnsupportedOperationException count not supported on this type: FiniteDomain clojure.lang.RT.countFrom (RT.java:545)
- 0.8.0-beta4-SNAPSHOT (739ec7e): ([1 2 3]) (correct result)
I've checked and commit 07f2f6a introduced the fix, so this is possibly related to LOGIC-77.
When trying to isolate the bug I found that:
- Using `(interval 1 3)` instead of `(domain 1 2 3)` works.
- Using two fresh variables instead of three works:
(run* [q]
(fresh [x y]
(infd x y (domain 1 2))
(<fd x y)
(== q [x y])))
;=> ([1 2])
Here's a test that checks the behavior. The test works in the latest version but fails in all commits before 07f2f6a.
(deftest test-domfd-three-lvars []
(is (= (run* [q]
(fresh [x y z]
(infd x y z (domain 1 2 3))
(<fd x y)
(<fd y z)
(== q [x y z])))
'([1 2 3]))))
Activity
David Nolen
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Resolution | Declined [ 2 ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
So is there a bug in master or not? To keep tracking issues simpler, if the bug does not exist in master please don't open a ticket.