Hey, everyone! Hopefully I post this question in a right place.
I have a project that allows users to declaratively create “rules” on data (hashmap): basically a set of predicates and actions.
E.g.: when value of field
:summ-1 (of hashmap) less than value of
:summ-2, assoc new field
:result with value
(+ :summ1 :summ2). Like formulas, with predicates, calculations and references to fields a la Excel spreadsheets.
I’ve started implementing these “rules” as multimethods, writing individual code for each possible predicate and action that user might need. But this approach has a big downside: for future extensions it requires to modify source code, recompile, etc.
I wonder if I can extend functionality and add my hashmap-predicates and hashmap-transformers on a runtime, preferrably in declarative manner (as data)? Perhaps I can use some suitable library/DSL? Query languages, DMLs? Logic programming?
I want to leverage something (powerful) instead of writing my own library of functions.