clara

http://www.clara-rules.org/
hadils 2019-08-04T14:53:35.008600Z

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!

2019-08-04T18:08:51.009700Z

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

2019-08-04T18:10:19.011100Z

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

2019-08-04T18:12:11.013500Z

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

1๐Ÿ‘