Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created April 21, 2011 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swannodette/933791 to your computer and use it in GitHub Desktop.
Save swannodette/933791 to your computer and use it in GitHub Desktop.
class.clj
(defrel is* a b)
(defn load-class [c]
(let [bs (bases c)]
(doseq [x bs]
(fact is* c x)
(load-class x))))
(def is
(tabled [a b]
(cond-e
((is* a b))
((exist [c]
(is* a c)
(is c b))))))
(load-class String)
(load-class clojure.lang.PersistentVector)
(load-class clojure.lang.PersistentHashMap)
(load-class clojure.lang.PersistentHashSet)
(load-class clojure.lang.PersistentList)
(run* [q]
(is q clojure.lang.Counted))
; =>
(clojure.lang.Indexed
clojure.lang.PersistentList
clojure.lang.IPersistentSet
clojure.lang.IPersistentMap
clojure.lang.APersistentVector
clojure.lang.PersistentVector
clojure.lang.APersistentMap
clojure.lang.IPersistentVector
clojure.lang.PersistentHashMap
clojure.lang.APersistentSet
clojure.lang.PersistentHashSet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment