Fork me on GitHub
#clara
<
2019-08-04
>
hadils14:08:35

Hi! I am new to Clara. I am very excited to be using it, but I am having difficulty with debugging a rule:

(defrule processed-transactions-rule
  [?account <- Account (= type :bank)]
  [TransactionSettings (= ?db db)]
  =>
  (insert-all! (get-processed-txs ?db ?account)))
The error I get is:
CompilerException clojure.lang.ExceptionInfo: Failed compiling alpha node
{:expr (clojure.core/fn [?__fact__ ?__env__] (clojure.core/let [this ?__fact__ ?__bindings__ (clojure.core/atom {})] (clojure.core/let [?db stackz.laws/db] (clojure.core/swap! ?__bindings__ clojure.core/assoc :?db ?db) (clojure.core/deref ?__bindings__)))), :condition {:type stackz.laws.TransactionSettings, :constraints [(= ?db stackz.laws/db)]}, :env nil}
 {:expr (clojure.core/fn [?__fact__ ?__env__] (clojure.core/let [this ?__fact__ ?__bindings__ (clojure.core/atom {})] (clojure.core/let [?db stackz.laws/db] (clojure.core/swap! ?__bindings__ clojure.core/assoc :?db ?db) (clojure.core/deref ?__bindings__)))), :condition {:type stackz.laws.TransactionSettings, :constraints [(= ?db stackz.laws/db)]}, :env nil}, compiling:(form-init5589377441026521223.clj:1:8) 
Can anyone point me in the right direction? Thanks!

mikerod18:08:51

@hadilsabbagh18 is there any more stack trace to be seen? Perhaps *e in REPL after you see this or something?

mikerod18:08:19

Oh. How is db defined? Is it a field on either a record/type/class named TransactionSettings?

mikerod18:08:11

Based on the form trying to be compiled there it looks like Clara cannot resolve what db is for that class so it is assuming it’s just a symbol resolving to something in the namespace stacks.laws.db/db

👍 4