You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is this the infix macro or the from-string (or both?)
would be interested to see the clojure.walk version + how well of a replacement it would be if it is cleaner & provides the same or better functionality
clojure walk version is built off of what you already have, just doesn't have the notion of recursing
it's a bit messy for doing the "^" conversion (lots of reversing, but this is code that gets called almost never).
so, main difference is that i have a mapping of which functions need to be rewritten forward, then backward.
i do 2 stages of rewrite, an infix->paren rewrite, then infix->prefix
my functions only deal with binary operators, while your code handles unary. i think it would be easy for me to add that functionality back in (i just had different requirements for the code).
the rewrite-op-backwards rewrite-op-forwards have duplicate code, so they can be refactored
2^2^2^2 will give a result that is like (((2 ^ 2) ^ 2) ^ 2) which is 16^2
i actually have my own implementation of what you wrote, that relies on clojure.walk
if you are ok with that, i can issue a PR with some more tests
The text was updated successfully, but these errors were encountered: