I want of create simplifier of arithmetic expressions in Clojure, and I am new to this language.
So for ex.:
in: "2x + 6y - (12 + (5x - 3y)) + 4"
simplified: "- 3x + 9y - 8".
So my attempt is to parse expression with regexp into hierarchical vector of nested expressions like this:
["5x-3y" "12 + <?>" "2x + 6y - <?> + 4"] ;; <?> is evaluated item from
previous step
and then evaluate them in sequence.
I am feeling like it's hack, some advice would be helpful.