This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-24
Channels
- # beginners (64)
- # calva (40)
- # cider (76)
- # clara (13)
- # clojure (72)
- # clojure-dev (34)
- # clojure-italy (4)
- # clojure-nl (14)
- # clojure-poland (1)
- # clojure-uk (30)
- # clojurescript (58)
- # clr (10)
- # core-async (101)
- # cursive (31)
- # datomic (9)
- # emacs (20)
- # fulcro (2)
- # jackdaw (1)
- # jobs (3)
- # juxt (3)
- # luminus (4)
- # lumo (15)
- # mount (4)
- # nrepl (29)
- # nyc (1)
- # off-topic (27)
- # qlkit (1)
- # quil (5)
- # re-frame (19)
- # reitit (8)
- # remote-jobs (4)
- # rewrite-clj (5)
- # shadow-cljs (45)
- # spacemacs (22)
- # sql (9)
- # uncomplicate (1)
- # xtdb (14)
it looks like a "one-to-one" port of existing drools rules is problematic. Drools has a way for you to veto a rule firing, it also can allow us to skip rule groups. It looks like the equivalent involves just ensuring proper behavior by writing appropriate when clauses. I do like how using a defrecord to predicate on is simple.
i suppose the "clara way" to control groups would be to modify the productions --- add predicate(s)
i'm getting infinite loops: (defrule has-email "allow rule" [User (= "<mailto:[email protected]|[email protected]>" email)] [:not [Decision (contains? #{:allow} type)]] => (insert! (->Decision :allow)) (println "allowed")) (defrule has-email-deny "deny if not allowed" [:not [Decision (contains? #{:allow :deny} type)]] => (insert! (->Decision :deny)) (println "denied")) trying to make "allow" take precedence over "deny" decisions, but either my "contains" or universal non-existence seems to not be working.
@UH13Y2FSA Does your Decision record have a "type" field? Perhaps you're running into https://github.com/cerner/clara-rules/issues/259
If that is the problem you can fix it by using an explicit field lookup e.g. (:type this)
Regarding looking at fired rules, the idiomatic way to get output from the session would usually be to have facts that represent that output and query on those facts. The tracing listener will tell you what rules fired, but it will also include rules that were later retracted. The API guarantees are generally around the final state of the session, not what rules are fired on the way there. It's possible to design rules in a way that constrains this, but this has to be done carefully and wouldn't be my first approach to solving a given problem. The tracing listener is primarily intended for debugging and performance problem diagnosis.