I'm trying to write a macro that takes a vector of bindings and a function that can access these bindings. In the simplest form:
(defmacro f-with-binds [binds f]
`(let [~@binds]
~f))
even though the above works:
(f-with-binds [n 123 m 456] (println n m)) ;; => 123 456
I am not happy with this because Cursive highlights n
and m
as undeclared variables which does not happen for macros like for
and let
. How can I improve my implementation?
ps.: the real macro returns a transducer - bindings are the transducer's state and function is the transducer's step function