I'm not sure if this is exactly what you need, but if I do this:
(letfn [(fn-a [] (println 1)) (fn-b [] (println 2)) (fn-c [] (fn-b))] (defmacro my-macro [stuff] `(let [whatever# ~(fn-b)] ~(fn-c))))
then it works - it just needs a tilde to irrevocably call function calls.
Both of the following work:
(defn fn-x [] (println 1)) (defn fn-y [] (fn-x)) (defmacro my-macro2 [stuff] `(let [whatever# (fn-x)] (fn-y)))
and
(defn fn-x [] (println 1)) (defn fn-y [] (fn-x)) (defmacro my-macro2 [stuff] `(let [whatever# ~(fn-x)] ~(fn-y)))
In the first case, functions are evaluated and their results are included in the macro at compile time, while in the second they are evaluated at runtime. With letfn (the macro itself), the results are not available at compile time (presumably because they compile after the macro is compiled), so functions can only be used at run time.
source share