Created
August 4, 2014 01:35
-
-
Save rksm/562cd712cf843080cf4c to your computer and use it in GitHub Desktop.
Conditional call in Macro with gensym binding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro foo | |
[& [fn]] | |
`(let [env# 123] | |
~(when fn `(~fn env#)))) | |
;; then expanded form of env does not match: | |
(macroexpand '(foo identity)) ;=> (let* [env__17699__auto__ 123] (identity env__17698__auto__)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem: auto gensyms only work in the form they were created in. To solve the issue, manual gensyms are required.