Fork me on GitHub

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:


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 Hi can you comment on this gist. It looks like defsession with :fact-type-fn does not stick with the var


Thank you, I'll check out.


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


@, I don’t typically use the defsession macro, but it seems to me that it is building the call to mk-session differently.

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


To get this to work,

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


@ 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. . 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..