Two following examples of using a function in a macro result in evaluations without errors.
(defmacro works [] (let [f (fn [] 1)] `(~f))) (works) ;; =&
See this example that does also throw the exception:
(defmacro does-also-not-work [] (let [x 4 f (fn [] x)] `(~f)))
Just like the result of constantly, but unlike your first two examples, f here is a closure. Apparently, closures created during macro-expansion time do not persist.
constantly
f