clara

http://www.clara-rules.org/
futuro 2020-09-30T00:08:51.003300Z

You probably want two rules, one for when there’s a match and one for when there isn’t (using the :not predicate)

PB 2020-09-30T15:17:20.004400Z

@futuro it's possible for it to match multiple rules, but there is a preference as to which one we want to use. Right now I'm assigning a priority to the matches and then using an accumulator to select the best. Is this a valid approach?

1
2020-09-30T19:30:49.011700Z

Yes. Priority sort of logic comes up often in my past usages

PB 2020-09-30T19:31:29.012100Z

Thanks @defndaines @mikerod

2020-09-30T19:34:05.012800Z

This this was a related gist I did about it long ago. Not sure if it’s exactly the same situation though.

PB 2020-09-30T19:37:46.013200Z

@mikerod that's very useful. It does look like you're using clojure maps over records?

2020-09-30T19:46:47.013800Z

@petr just for the sake of example. Either would work for the concept

PB 2020-09-30T19:47:34.014600Z

Of course. I think I would prefer to use maps over records in my code-base. I was excited to see an example. I didn’t know it was possible