<< Back to previous view

[LOGIC-79] Setting finite domain on more than two lvars using domain fn throws UnsupportedOperationException Created: 18/Dec/12  Updated: 28/Jul/13  Resolved: 20/Dec/12

Status: Closed
Project: core.logic
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Frederik De Bleser Assignee: David Nolen
Resolution: Declined Votes: 0
Labels: None

Clojure 1.4.0 , core.logic 0.8.0-beta3


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]))))

Comment by David Nolen [ 18/Dec/12 9:29 AM ]

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.

Comment by Frederik De Bleser [ 18/Dec/12 9:34 AM ]

The issue is fixed in master.

I still wanted to report it since it seems to somehow relate to LOGIC-77 – maybe I should just have added a comment there.

Sorry for the confusion.

Comment by David Nolen [ 20/Dec/12 11:51 PM ]

Not relevant to master.

Generated at Thu Jan 18 00:20:50 CST 2018 using JIRA 4.4#649-r158309.