You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swannodette edited this page May 19, 2012
·
21 revisions
core.logic was designed with extensibility in mind. You may want to unify your own custom data structures - not only the ones provided for by Clojure. To see how this can be done we'll use Datomic Datum's as an example.
For the following examples, assume the following ns declaration:
In order for your custom data structure to participate in unification it must implement IUnifyTerms. For Datomic Datum's this looks like the following:
(extend-type datomic.db.Datum
l/IUnifyTerms
(l/unify-terms [u v s]
(unify-with-datum v u s)))
u is of course the Datum, v is other structure being unified with and s is the substitutions map.