clara

http://www.clara-rules.org/
2019-05-10T10:04:34.110100Z

The :production-seq option is for tagging a var that holds a list in a namespace that its rules should be considered part of the namespace when using the namespace (more precisely, the symbol of the namespace) as a rules source. You don’t need that (or any) metadata on a collection if you just pass the rules in to mk-session, and they don’t have to be literally referenced - you can use any Clojure code that evaluates to the collection. So (mk-session (arbitrary-fn-that-returns-collection-of-rule-data-structures)) would work. You could, say, have that function scan the vars in a namespace yourself and filter them on the name, their metadata, or other criteria you choose. To be honest I think it’s hard to say much about the ideal way to organize rules without knowing more about the use-case in question.

1👍
2019-05-10T10:06:27.110300Z

One other thought is that it is entirely possible to have a single session with highly partitioned “regions” based on the rules DAG. For example, a “cluster” of rules that produce a single output and that have no other interactions with different “clusters” of rules. This requires some discipline in whatever conventions you establish of course, but it is possible to have separation of concerns within the rules of a single session.

2019-05-10T13:05:10.110700Z

The API constraint is that mk-session needs to receive unevaluated code in the same format that the defrule and defmacro macros construct. I’ve worked on cases where the rules were generated from a DSL that had quite a bit of processing into Clara rule forms, so what you’re suggesting sounds plausible.

2019-05-10T13:06:09.110900Z

Thanks for the points on :production-seq @wparker I never got back to that one. I’ll note that I’m thinking it will not be a good idea to do (mk-session (arbitrary-fn-that-returns-collection-of-rule-data-structures)) in CLJS by the way, but I think we are only discussing CLJ here. See https://github.com/cerner/clara-rules/issues/388#issuecomment-489747471 for more on my endless struggle w/our current CLJS impl if that is of interest to you. 😱

2019-05-10T13:09:55.111200Z

Yeah, :production-seq is clj-only. I am indeed interested in the cljs stuff you logged 🙂 , just haven’t had time to review it yet unfortunately

1👍