This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-26
Channels
- # aws (7)
- # beginners (109)
- # boot (5)
- # carry (2)
- # cider (25)
- # clara (6)
- # cljs-dev (86)
- # cljs-experience (19)
- # cljsrn (1)
- # clojure (183)
- # clojure-dev (7)
- # clojure-dusseldorf (7)
- # clojure-gamedev (2)
- # clojure-greece (32)
- # clojure-italy (2)
- # clojure-norway (1)
- # clojure-russia (228)
- # clojure-sg (3)
- # clojure-spec (38)
- # clojure-uk (104)
- # clojurebridge (1)
- # clojurescript (29)
- # community-development (9)
- # core-async (118)
- # core-matrix (20)
- # cursive (5)
- # datomic (140)
- # emacs (25)
- # figwheel (1)
- # hoplon (21)
- # jobs (4)
- # lein-figwheel (2)
- # luminus (10)
- # lumo (35)
- # off-topic (137)
- # om (31)
- # onyx (62)
- # pedestal (6)
- # reagent (25)
- # remote-jobs (1)
- # ring-swagger (11)
- # spacemacs (2)
- # test-check (17)
- # uncomplicate (10)
- # unrepl (1)
- # untangled (20)
- # vim (4)
- # yada (3)
Can someone point me to documentation about how to construct clara rules dynamically?
AFAIK defrule
just generates a data structure so you can either build that by hand dynamically or check out clara.rules.dsl/parse-rule
@puzzler There are a number of examples of dynamic rule creation in https://github.com/cerner/clara-rules/blob/master/src/test/clojure/clara/test_rules.clj You can also just build the rule data structures yourself if that is more convenient for your use-case; see the schema at https://github.com/cerner/clara-rules/blob/master/src/main/clojure/clara/rules/schema.clj#L62
You’ll need to fully qualify reference in your LHS (left-hand side) code if you use that approach, although in the RHS code it will evaluated in the ns you give if you give one as noted in the comment on the schema; that would be good to do in the LHS too, it just hasn’t been implemented yet
There is also an example of generating rules from an external DSL on this blog post. Towards the bottom you'll see the Clojure data structure that defines the rules themselves. http://www.toomuchcode.org/blog/2015/11/14/insta-declarative-dsls/