This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-15
Channels
- # admin-announcements (60)
- # adventofcode (37)
- # beginners (53)
- # boot (94)
- # bristol-clojurians (1)
- # cider (21)
- # clara (19)
- # cljsrn (1)
- # clojure (222)
- # clojure-chicago (1)
- # clojure-dev (2)
- # clojure-nl (11)
- # clojure-russia (301)
- # clojure-turkiye (1)
- # clojurecup (6)
- # clojurescript (30)
- # core-async (3)
- # cursive (64)
- # datascript (2)
- # datomic (55)
- # devops (16)
- # editors (1)
- # emacs (16)
- # ldnclj (6)
- # off-topic (18)
- # om (113)
- # onyx (3)
- # parinfer (1)
- # proton (48)
- # re-frame (20)
- # reagent (7)
@ryanbrush: Is there any way to reference elements of the rule itself, within the rule?
@ryanbrush: for instance, it would be cool if I could bind $?name $?docstring or $?lhs
So I could push forward some additional metadata about the rule which inserted a fact, for instance
@devn It's not in the public API, but the clara.rules.engine/rule-context dynamic var is populated when a rule is firing. So you could do something like (get-in clara.rules.engine/rule-context [:node :production]) , which would have :name and :doc properties.
@ryanbrush: ah perfect
@devn It would be simple to add a (current-rule) function that just returns that to the public namespace as well. I can see how it would be useful.
It doesn't use meta (but that would be add-able). This might be a good case for rule properties. You could do (defrule my-rule {:cool true} "doc here" ... => ...) This is how rule salience is set but you can put arbitrary properties there.
See the salience example for the structure: http://www.clara-rules.org/docs/conflictsalience/
I ran into a situation with salience and accumulators. I don't have a simple repro as it was a month ago or so now