This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-02
Channels
- # aws-lambda (1)
- # beginners (28)
- # boot (54)
- # cider (11)
- # clara (28)
- # cljs-dev (74)
- # cljsrn (13)
- # clojure (342)
- # clojure-austin (3)
- # clojure-dusseldorf (4)
- # clojure-france (2)
- # clojure-greece (11)
- # clojure-italy (42)
- # clojure-poland (7)
- # clojure-russia (11)
- # clojure-spec (44)
- # clojure-uk (156)
- # clojure-ukraine (4)
- # clojurescript (102)
- # cursive (17)
- # datascript (19)
- # datomic (17)
- # dirac (39)
- # emacs (22)
- # funcool (56)
- # hoplon (25)
- # jobs (3)
- # jobs-discuss (31)
- # leiningen (2)
- # luminus (4)
- # lumo (3)
- # off-topic (47)
- # om (51)
- # onyx (57)
- # re-frame (13)
- # reagent (57)
- # remote-jobs (15)
- # ring (9)
- # ring-swagger (7)
- # robots (2)
- # rum (6)
- # specter (16)
- # sql (7)
- # test-check (37)
- # untangled (7)
- # yada (5)
I have a question about using guards on rules in Clara. I am aiming to create rules that can never insert a fact that already exist. The guard statement works fine if I am manually inserting the fact that the guard stops, but if the rule itself is creating this statement the guard does not stop the rule from triggering again and I get an infinite loop.
with a naive implementation of rules where each rule is checked separately I can see this not being an issue as after each insertion the guard would be checked and with the new fact that guard would be passed. Could this be a bug in the implementation, where somehow not the full condition of the rule is checked for it to fire again?
maybe i didnt understand what you meant by gaurds, but if a rule inserts something that that same rule looks at, its pretty much always going to cause another firing
this means if the result of the rule puts in the guard of the rule the fact loses support gets retracted and the rule fires again
Sounds correct, looking through https://github.com/cerner/clara-examples/blob/master/src/main/clojure/clara/examples/truth_maintenance.clj and http://www.clara-rules.org/docs/truthmaint/ might be helpful ๐
You can use unconditional insertions that wonโt use truth maintenance if necessary. In our use cases we strongly prefer truth maintenance and find that it makes the code simpler to reason about, but obviously use-cases differ
i was staring at this like a whole evening thinking what the problem could be, whoops.
It kind of solves pretty much every problem I had with clara though, so that is a relief
so you are saying you were stuck in an infinite loop about the infinite loop and the truth about truth maintenence resolved it
yeah basically using a guard with truth maintenance, where the result of the rule (or another) triggers the guard can start an infinite loop
(i was just making a light hearted joke about how your proccess of realizing how it was working was similar to a rules network) though your understanding sounds correct to me
Oh yes. Still cleaning up that site some. Going to change the theme since it sucks on mobile. However the content is there.