Hello, With the code below you can query transitive relationships between entities successfully. Is there any way to use core.logic "explain" the relationship? Specifically, is there any way to write a function explain so that:
> (explain :pitbull :chordate) will give you: [:pitbull :dog] [:dog :mammal] [:mammal :chordate] Thanks, Stathis Code: (ns test.logic (:refer-clojure :exclude [==]) (:use clojure.core.logic)) (defrel is-a Entity Parent) (fact is-a :pitbull :dog) (fact is-a :dog :mammal) (fact is-a :mammal :chordate) (fact is-a :chordate :animal) (defn transitive [r] (fn t [p1 p2] (fresh [intermediate] (conde ((r p1 p2)) ((r p1 intermediate) (t intermediate p2)))))) (defn iso [entity parent] ((transitive is-a) entity parent)) In the REPL: > (run* [q] (iso :dog :animal)) (_.0) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en