core.logic

core.logic converts defrecords to maps in it's query results

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • 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?

Activity

Hide
David Nolen added a comment -

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.

Show
David Nolen added a comment - 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.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: