Fork me on GitHub
#clara
<
2019-12-31
>
matthew.pettis18:12:05

Does anyone know of any examples of clara-rules that solve logic problems? Or similarily, sudoku? I'm looking for examples of rules, or good architecture, to make rules that enforce unique exclusions. Such as in logic problems found here: https://www.brainzilla.com/logic/logic-grid/apples-to-apples/

matthew.pettis18:12:46

I"m looking to do this in an industrial setting ("machine A can't be on if machine B is on", or "machine B cannot turn on unless machine A is already on", etc.) Logic puzzles seem to be a template for what this concept is...

geraldodev19:12:41

https://gist.github.com/geraldodev/076ccb995db907644070f134656fb74b Hi can you comment on this gist. It looks like defsession with :fact-type-fn does not stick with the var

matthew.pettis20:12:22

Thank you, I'll check out.

matthew.pettis20:12:09

Sorry, thought this was related to my question...

ethanc20:12:59

@, I don’t typically use the defsession macro, but it seems to me that it is building the call to mk-session differently. https://github.com/cerner/clara-rules/blob/master/src/main/clojure/clara/rules.cljc#L368

(mk-session [:fact-type-fn :type])
vs
(mk-session :fact-type-fn :type)
so the session in this case is empty(no productions) due to defsession not appending the current namespace.

ethanc20:12:30

To get this to work,

(defsession session `app.mv.clara2 :fact-type-fn :type)
the namespace would have to be provided

geraldodev01:01:36

@ Thank you!. I've started with (def session (mk-session . Later I've switched to defsession. Also I was trying to infer changes on the sql table based on the primary key. The plan was to baby sit the session like an atom. I've stumbled across a issue that shows that clara ignores facts that are not touched by rules and queries. https://github.com/cerner/clara-rules/issues/48 . I was intending to use it wrong. It looks like reading the table, insert the facts and collect the results and let the session go way is a more correct approach..