I'm trying to get to grips with core.logic.
Can I use complex data-structures in facts and rules?
For example, I'm trying to do this :
(pldb/db-rel test a)
(defn is-wibble? [a] (= true (:wibble a)))
(def facts
(pldb/db
[test {:name "x" :wibble true}]
[test {:name "y" :wibble false}]
[test {:name "z" :wibble true}]))
(defn -main [& args]
(doseq [x
(pldb/with-db facts
(run* [q]
(is-wibble? q)))]
(println x))))
But it's throwing an error :
Caused by: java.lang.ClassCastException: java.base/java.lang.Boolean cannot be cast to clojure.lang.IFn
at clojure.core.logic.Substitutions.bind(logic.clj:425)
at polvo.core$_main$fn__377$fn__378$fn__379$_inc__380.invoke(core.clj:223)
Actually at the line
(is-wibble? q)
Am I wrong to try to create rules as normal functions? Or put complex data into facts?