infix
infix copied to clipboard
Adding functionality
I wanted to add some features not built-in to infix, so I did the following:
- Defined the routines I wanted to use:
(defn max [a, b] (Math/max a, b))
(defn min [a, b] (Math/min a, b))
- Created a map with those routines:
(def obz-fns {:max max
:min min})
- Merged them into the existing routines:
(def all-fns (merge base-env obz-fns))
- I then use my
all-fnswhen calling from-string:
((from-string [] (merge all-fns local-vars) "min(a,b)")))
This seems to be pretty trauma free. Just wondering if I should beware of any particular dangers.
That is usage exactly as intended