core.logic

Combining maps and finite domains in core.logic returns only one result

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Environment:
    Clojure 1.4.0, core.logic 0.8.0-beta2

Description

I'm trying to combine maps with finite domains with some odd results.

A simple query using finite domains correctly returns all values:

(run* [q]
	  (fresh [x]
	    (infd x (interval 1 3))
	    (== q x)))
	
	;=> (1 2 3)

But putting this result in a map returns only the first value:

(run* [q]
	  (fresh [x]
	    (infd x (interval 1 3))
	    (== q {:foo x})))
	
	;=> ({:foo 1})

FYI this works with vectors:

(run* [q]
	  (fresh [x]
	    (infd x (interval 1 3))
	    (== q [x])))
	
	;=> ([1] [2] [3])

But lcons seems to fail as well:

(run* [q]
	  (fresh [x]
	    (infd x (interval 1 3))
	    (== q (lcons x 'foo))))
	
	;=> ((1 . foo))

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: