Fork me on GitHub
#clara
<
2020-09-30
>
futuro00:09:51

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

kvlt15:09:20

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

mikerod19:09:49

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

kvlt19:09:29

Thanks @defndaines @mikerod

mikerod19:09:05

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

kvlt19:09:46

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

mikerod19:09:47

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

kvlt19:09:34

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