>This use-case has been achieved using a single Clojure variable.
Can you expand more on how the business rules are executed with the variable ? Maybe a simple example ? Clojure-newbie looking to learn more :)
Can you expand more on how the business rules are executed with the variable ? Maybe a simple example ? Clojure-newbie looking to learn more :)
when X then do Y
You can write them in Clojure like in the above example: [:rule [:when X] [:then Y]]
which is kind of self-explanatory. X and Y can be any valid predefined expressions, e.g. [:rule [:when [:< amount 100]] [:then [:send-email-to-boss]]]
If you had such a rule, you'd just parse that line as edn, substitute all symbols (check for injection attacks) and execute it.However, effectively clojure itself is most often the smallest representation:
(when (< amount 100) (send-email-to-boss))
It's just not that readable because it's missing the "then", but it would be valid clojure right away.In the end it's like a code snippet that non-developers can write without having to set up a compiler, run-time, syntax-checker