<< Back to previous view

[LOGIC-53] core.logic converts defrecords to maps in it's query results Created: 18/Sep/12  Updated: 28/Jul/13  Resolved: 02/Jan/13

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

Type: Defect Priority: Blocker
Reporter: Martin Trojer Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: 0.8.0
Environment:

0.7.5 or 0.8-alpha



 Description   
(defrecord Test [a b])

(run* [q]
  (== q (->Test 1 2 )))

;; ({:a 1, :b 2})
;; Where's my record?


 Comments   
Comment by David Nolen [ 19/Sep/12 12:02 PM ]

Records are IPersistentMaps. core.logic doesn't know anything about your custom type so it returns the type it knows how to unify.

If you want core.logic to work with your record you need to implement the unification protocols for you record. But of course that's a little tedious if you have many different records.

Open to better ideas. The relevant code where this unexpected behavior occurs is the implementation of IWalkTerm for the core Clojure data types.

Comment by David Nolen [ 02/Jan/13 7:18 PM ]

fixed, http://github.com/clojure/core.logic/commit/bd3f13a1cd3214e5e15e52383b49f0a54ec8a502

Generated at Wed Apr 16 02:48:23 CDT 2014 using JIRA 4.4#649-r158309.