<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions and answers in Macros</title>
<link>https://ask.clojure.org/index.php/qa/clojure/macros</link>
<description></description>
<item>
<title>Why doesn't defn also implicitly name the anonymous function it defines for recursion?</title>
<link>https://ask.clojure.org/index.php/15000/doesnt-defn-implicitly-anonymous-function-defines-recursion</link>
<description>&lt;p&gt;Why doesn't &lt;code&gt;defn&lt;/code&gt; implicitly name the function to create a named recursion point?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(clojure.walk/macroexpand-all
  '(defn foo [x]
     (foo x)))
; =&amp;gt;
(def foo
  (fn*
    ([x]
     (foo x))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This could instead expand to&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def foo
  (fn* foo ; note the foo here
    ([x]
     (foo x))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;How it works right now, &lt;code&gt;foo&lt;/code&gt; resolves to a global var &lt;code&gt;#'foo&lt;/code&gt;, which is created when the &lt;code&gt;(def ...)&lt;/code&gt; form is analyzed. In the second case, it resolves directly to the function object. Thus, it should save us a var dereference at runtime in this case.&lt;/p&gt;
&lt;p&gt;EDIT: Found out, this is exactly what &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/compilation#directlinking&quot;&gt;direct linking&lt;/a&gt; is used for.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15000/doesnt-defn-implicitly-anonymous-function-defines-recursion</guid>
<pubDate>Sat, 21 Mar 2026 13:49:43 +0000</pubDate>
</item>
<item>
<title>Answered: specifying `:let` as the first element of `for` causes an macro expansion error</title>
<link>https://ask.clojure.org/index.php/14670/specifying-let-first-element-causes-macro-expansion-error?show=14671#a14671</link>
<description>&lt;p&gt;Seems like it is working as intended per the docstring.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14670/specifying-let-first-element-causes-macro-expansion-error?show=14671#a14671</guid>
<pubDate>Mon, 11 Aug 2025 01:09:48 +0000</pubDate>
</item>
<item>
<title>Answered: `doseq` and `for` expands body twice</title>
<link>https://ask.clojure.org/index.php/14433/doseq-and-for-expands-body-twice?show=14442#a14442</link>
<description>&lt;p&gt;Logged as &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2900&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2900&lt;/a&gt;, happy to see a patch if you make one.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14433/doseq-and-for-expands-body-twice?show=14442#a14442</guid>
<pubDate>Wed, 05 Mar 2025 18:46:08 +0000</pubDate>
</item>
<item>
<title>Answered: defn rejects arity with args vector [&amp;form]</title>
<link>https://ask.clojure.org/index.php/14057/defn-rejects-arity-with-args-vector-form?show=14073#a14073</link>
<description>&lt;p&gt;Logged as &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2874&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2874&lt;/a&gt;&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14057/defn-rejects-arity-with-args-vector-form?show=14073#a14073</guid>
<pubDate>Wed, 21 Aug 2024 15:05:58 +0000</pubDate>
</item>
<item>
<title>Answered: `cond-let` macro as pair for `if-let`, similar to `if`/`conf` pair</title>
<link>https://ask.clojure.org/index.php/12912/cond-let-macro-as-pair-for-if-let-similar-to-if-conf-pair?show=14050#a14050</link>
<description>&lt;p&gt;+1 for this.&lt;/p&gt;
&lt;p&gt;This is when you want the conditional expression to return a useful value instead of true/false and use that value in the body as is.&lt;br&gt;
If there are multiple conditions, the if-let is nested, but being able to describe it flatly is considered to contribute to readability.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12912/cond-let-macro-as-pair-for-if-let-similar-to-if-conf-pair?show=14050#a14050</guid>
<pubDate>Sat, 10 Aug 2024 18:39:14 +0000</pubDate>
</item>
<item>
<title>Answered: Returning the last assigned value from `let` w/o a body</title>
<link>https://ask.clojure.org/index.php/13782/returning-the-last-assigned-value-from-let-w-o-a-body?show=13783#a13783</link>
<description>&lt;p&gt;This behavior is expected, as with any other form that evaluates a body. The return value is the final expression in the body. If you want to return one of your bindings, you must do so explicitly. This is even shown in the example in the official Clojure documentation about the &lt;code&gt;let&lt;/code&gt; special form, at &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/special_forms#let&quot;&gt;https://clojure.org/reference/special_forms#let&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you are using a good linter like clj-kondo, it will warn you if you have any bindings that you have not done anything with.&lt;/p&gt;
&lt;p&gt;Changing this would be quite jarring for people who are used to LISPs, and make &lt;code&gt;let&lt;/code&gt; inconsistent with other forms in Clojure as well.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13782/returning-the-last-assigned-value-from-let-w-o-a-body?show=13783#a13783</guid>
<pubDate>Wed, 13 Mar 2024 23:46:15 +0000</pubDate>
</item>
<item>
<title>Answered: Useful macro for output redirection (feature request)</title>
<link>https://ask.clojure.org/index.php/13246/useful-macro-for-output-redirection-feature-request?show=13247#a13247</link>
<description>&lt;p&gt;A counterpoint: &lt;code&gt;(with-err-out (do-stuff))&lt;/code&gt; is hardly shorter or more readable than &lt;code&gt;(binding [*out* *err*] (do-stuff))&lt;/code&gt;.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13246/useful-macro-for-output-redirection-feature-request?show=13247#a13247</guid>
<pubDate>Mon, 04 Sep 2023 14:59:22 +0000</pubDate>
</item>
<item>
<title>Answered: Macro does not work properly</title>
<link>https://ask.clojure.org/index.php/13127/macro-does-not-work-properly?show=13128#a13128</link>
<description>&lt;p&gt;I think there are probably several predicate related issues here. For the first condition, I think you'll want to use something broader than &lt;code&gt;list?&lt;/code&gt; (which is just for list collections) and instead maybe use something that includes seqs like &lt;code&gt;sequential?&lt;/code&gt;. I'm not sure what &lt;code&gt;function?&lt;/code&gt; is, but in your case those will be symbols so &lt;code&gt;symbol?&lt;/code&gt; should work. I suspect that's your current issue because that's the branch you're not seeing. You might want to add a fallthrough &lt;code&gt;:else&lt;/code&gt; branch in the cond to tell you when it doesn't match.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13127/macro-does-not-work-properly?show=13128#a13128</guid>
<pubDate>Thu, 03 Aug 2023 14:18:33 +0000</pubDate>
</item>
<item>
<title>Answered: Why functions which are used inside macro do not evaluate their arguments before executing?</title>
<link>https://ask.clojure.org/index.php/13123/functions-which-inside-evaluate-arguments-before-executing?show=13124#a13124</link>
<description>&lt;p&gt;Both the internal and external function are behaving the same - they receive a list.&lt;/p&gt;
&lt;p&gt;The evaluation happens prior to invocation (so it's not &quot;the function&quot; that is doing the evaluation but the call site invoking it).&lt;/p&gt;
&lt;p&gt;Here, the argument to &lt;code&gt;func&lt;/code&gt; and &lt;code&gt;helper&lt;/code&gt; is the symbol &lt;code&gt;expr&lt;/code&gt;. Symbols are evaluated by resolving that &quot;name&quot; to a value in the current lexical context, here defined in the defmacro parameters. It resolves to a list &lt;code&gt;(+ 1 2)&lt;/code&gt;. That list is passed to the function. Evaluating that list would require evaluating the argument twice!&lt;/p&gt;
&lt;p&gt;Macro expansion is not evaluation and the arguments are not evaluated.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13123/functions-which-inside-evaluate-arguments-before-executing?show=13124#a13124</guid>
<pubDate>Tue, 01 Aug 2023 21:53:22 +0000</pubDate>
</item>
<item>
<title>Answered: Using literal map as a dispatch fn in defmulti</title>
<link>https://ask.clojure.org/index.php/12920/using-literal-map-as-a-dispatch-fn-in-defmulti?show=12980#a12980</link>
<description>&lt;p&gt;Filed as &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2782&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2782&lt;/a&gt;&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12920/using-literal-map-as-a-dispatch-fn-in-defmulti?show=12980#a12980</guid>
<pubDate>Tue, 30 May 2023 16:48:06 +0000</pubDate>
</item>
<item>
<title>Answered: filter with multiple lists on params</title>
<link>https://ask.clojure.org/index.php/12793/filter-with-multiple-lists-on-params?show=12797#a12797</link>
<description>&lt;p&gt;Most preds used with filter take one arg, so this is not commonly needed.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12793/filter-with-multiple-lists-on-params?show=12797#a12797</guid>
<pubDate>Wed, 22 Mar 2023 19:58:57 +0000</pubDate>
</item>
<item>
<title>Answered: Access object field in macro without reflection</title>
<link>https://ask.clojure.org/index.php/12316/access-object-field-in-macro-without-reflection?show=12317#a12317</link>
<description>&lt;p&gt;The &lt;code&gt;^&lt;/code&gt; reader does not resolve symbols and accepts symbols and strings as tags (&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/0035cd8d73517e7475cb8b96c7911eb0c43a1a9d/src/jvm/clojure/lang/LispReader.java#L955-L956&quot;&gt;impl&lt;/a&gt;). &lt;br&gt;
Consequently, the compiler doesn't look at anything but symbols and strings (&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/0035cd8d73517e7475cb8b96c7911eb0c43a1a9d/src/jvm/clojure/lang/Compiler.java#L7556-L7563&quot;&gt;impl&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;With that being said, there's no warning if you preface &lt;code&gt;MyObj&lt;/code&gt; in &lt;code&gt;{:tag MyObj}&lt;/code&gt; with a syntax quote.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12316/access-object-field-in-macro-without-reflection?show=12317#a12317</guid>
<pubDate>Tue, 18 Oct 2022 11:27:28 +0000</pubDate>
</item>
<item>
<title>Answered: Would a generalized some-&gt; macro be useful?</title>
<link>https://ask.clojure.org/index.php/12272/would-a-generalized-some-macro-be-useful?show=12280#a12280</link>
<description>&lt;p&gt;Logged as &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2732&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2732&lt;/a&gt;&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12272/would-a-generalized-some-macro-be-useful?show=12280#a12280</guid>
<pubDate>Mon, 03 Oct 2022 16:24:21 +0000</pubDate>
</item>
<item>
<title>Answered: Auto-gensym in recursive macros</title>
<link>https://ask.clojure.org/index.php/12012/auto-gensym-in-recursive-macros?show=12013#a12013</link>
<description>&lt;p&gt;auto gensyming does the gensym at read time, not at macroexpand time. &lt;/p&gt;
&lt;p&gt;in order for auto gensym to gensym at macroexpand time, the syntax quote reader could be altered to produce a let binding.&lt;/p&gt;
&lt;p&gt;currently:&lt;br&gt;
&lt;code&gt;user=&amp;gt; (read-string &quot;`(x#)&quot;)
(clojure.core/seq (clojure.core/concat (clojure.core/list (quote x__9__auto__))))
user=&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;would become:&lt;br&gt;
&lt;code&gt;user=&amp;gt; (read-string &quot;`(x#)&quot;)
(clojure.core/let [foo (gensym 'x)] (clojure.core/seq (clojure.core/concat (clojure.core/list foo)))
user=&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;a consequence of that change would be a macro like clojure.core/and (picking a commonly used macro that uses gensyms at random) would gensym new symbols everytime it was expanded instead of once when the implementation is read. That might be fine? gensyming should be fast, the new symbols are used when compiling then forgotten about, the counter for gensym names can count really high. &lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12012/auto-gensym-in-recursive-macros?show=12013#a12013</guid>
<pubDate>Fri, 24 Jun 2022 21:40:26 +0000</pubDate>
</item>
<item>
<title>Answered: Bug (?) in with-open macro</title>
<link>https://ask.clojure.org/index.php/11447/bug-in-with-open-macro?show=11458#a11458</link>
<description>&lt;p&gt;Yep, should be cleaner in the expansion (but ignored during compilation). Added ticket and patch:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2683&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2683&lt;/a&gt;&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11447/bug-in-with-open-macro?show=11458#a11458</guid>
<pubDate>Tue, 11 Jan 2022 14:38:40 +0000</pubDate>
</item>
<item>
<title>Answered: Macroexpanding a macro with `fn` crashes with &quot;fn did not conform to spec&quot;</title>
<link>https://ask.clojure.org/index.php/11449/macroexpanding-macro-with-crashes-with-did-not-conform-spec?show=11456#a11456</link>
<description>&lt;p&gt;Not sure what version of Clojure or editor you're using but Clojure 1.10.3 gives more useful output in the standard repl:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (macroexpand '(m))
Syntax error macroexpanding clojure.core/fn at (REPL:1:1).
(user/x) - failed: Extra input at: [:fn-tail :arity-1 :params] spec: :clojure.core.specs.alpha/param-list
user/x - failed: vector? at: [:fn-tail :arity-n :params] spec: :clojure.core.specs.alpha/param-list
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you can see it is not running your code but (recursively) macroexpanding when the problem is encountered. The first expansion will become:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(clojure.core/fn [user/x])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;clojure.core/fn&lt;/code&gt; is itself a macro that is expanded. During that expansion, the &lt;code&gt;fn&lt;/code&gt; macro is checked against the &lt;code&gt;fn&lt;/code&gt; spec (this is on by default for macros). The spec finds &lt;code&gt;user/x&lt;/code&gt; and sees it as &quot;extra input&quot; in the &lt;code&gt;:params&lt;/code&gt; because it does not conform to any expected parameter form (unqualified symbols usually, but also all recursive destructuring forms). Really, the problem here is &lt;code&gt;user/x&lt;/code&gt; instead of &lt;code&gt;x&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;You can fix this with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defmacro m []
  `(fn [~'x]))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11449/macroexpanding-macro-with-crashes-with-did-not-conform-spec?show=11456#a11456</guid>
<pubDate>Tue, 11 Jan 2022 14:20:54 +0000</pubDate>
</item>
<item>
<title>Answered: Hash collisions in case statements try to evaluate the constants</title>
<link>https://ask.clojure.org/index.php/11395/hash-collisions-case-statements-try-evaluate-the-constants?show=11397#a11397</link>
<description>&lt;p&gt;Created a new ticket at &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2679&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2679&lt;/a&gt;&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11395/hash-collisions-case-statements-try-evaluate-the-constants?show=11397#a11397</guid>
<pubDate>Tue, 14 Dec 2021 14:58:45 +0000</pubDate>
</item>
<item>
<title>Answered: Macro defining function</title>
<link>https://ask.clojure.org/index.php/10911/macro-defining-function?show=10912#a10912</link>
<description>&lt;pre&gt;&lt;code&gt;(defmacro create-func [func-name attr] `(defn ~func-name [person] (~attr person)))
(create-func c-age :age)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you write this, it will expand to&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn c-age [user/person] (:age user/person))
Syntax error macroexpanding clojure.core/defn at (/tmp/form-init14482279258588584188.clj:1:1).
user/person - failed: vector? at: [:fn-tail :arity-n :bodies :params] spec: :clojure.core.specs.alpha/param-list
(user/person) - failed: Extra input at: [:fn-tail :arity-1 :params] spec: :clojure.core.specs.alpha/param-list
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To avoid this, you should write &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defmacro create-func [func-name attr] `(defn ~func-name [person#] (~attr person#)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or use another way to do not use qualified symbols in parameter name.&lt;/p&gt;
&lt;p&gt;create macros for &quot;getter&quot; is a antipattern in clojure.&lt;br&gt;
if you want to access a field, just access it. &lt;br&gt;
also, def-macros usually can be written as a function&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def c-age (im-not-a-macro :age))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10911/macro-defining-function?show=10912#a10912</guid>
<pubDate>Fri, 06 Aug 2021 11:43:21 +0000</pubDate>
</item>
<item>
<title>Answered: Macro for threading lambda expression</title>
<link>https://ask.clojure.org/index.php/10749/macro-for-threading-lambda-expression?show=10750#a10750</link>
<description>&lt;p&gt;Isn't it shorter to just put the # at the front of your thread expression?&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10749/macro-for-threading-lambda-expression?show=10750#a10750</guid>
<pubDate>Fri, 02 Jul 2021 21:03:39 +0000</pubDate>
</item>
<item>
<title>Answered: when-seq and if-seq as short-hand macros</title>
<link>https://ask.clojure.org/index.php/10450/when-seq-and-if-seq-as-short-hand-macros?show=10459#a10459</link>
<description>&lt;p&gt;Logged as &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2622&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2622&lt;/a&gt;&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10450/when-seq-and-if-seq-as-short-hand-macros?show=10459#a10459</guid>
<pubDate>Sat, 10 Apr 2021 20:22:46 +0000</pubDate>
</item>
<item>
<title>Answered: macroexpansion of macro with anonymous function argument</title>
<link>https://ask.clojure.org/index.php/10269/macroexpansion-of-macro-with-anonymous-function-argument?show=10270#a10270</link>
<description>&lt;p&gt;Try:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(macroexpand-1 '(func-macro (fn [x] x)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;with a normal single quote instead. You don't need the backtick here.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10269/macroexpansion-of-macro-with-anonymous-function-argument?show=10270#a10270</guid>
<pubDate>Sun, 28 Feb 2021 10:04:43 +0000</pubDate>
</item>
<item>
<title>Answered: Capture code as list</title>
<link>https://ask.clojure.org/index.php/10077/capture-code-as-list?show=10078#a10078</link>
<description>&lt;p&gt;My initial thought is that &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/brandonbloom/backtick&quot;&gt;backtick&lt;/a&gt; would help a bit.  Interesting question.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10077/capture-code-as-list?show=10078#a10078</guid>
<pubDate>Tue, 19 Jan 2021 20:00:03 +0000</pubDate>
</item>
<item>
<title>Answered: Using atoms inside macro</title>
<link>https://ask.clojure.org/index.php/9339/using-atoms-inside-macro?show=9340#a9340</link>
<description>&lt;p&gt;Macros are functions that take code and return code. Atoms are stateful objects - there is no way to represent them with identity  in code so this is not going to work.&lt;/p&gt;
&lt;p&gt;What are you actually trying to do?&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9339/using-atoms-inside-macro?show=9340#a9340</guid>
<pubDate>Sun, 31 May 2020 04:52:50 +0000</pubDate>
</item>
<item>
<title>Answered: binding macro wraps body in try, not do</title>
<link>https://ask.clojure.org/index.php/9052/binding-macro-wraps-body-in-try-not-do?show=9053#a9053</link>
<description>&lt;p&gt;&lt;code&gt;try&lt;/code&gt; has an implicit &lt;code&gt;do&lt;/code&gt; in it - what do you want to do that doesn't work?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(binding []
  (println &quot;1&quot;)
  (println &quot;2&quot;)
  3)
;; 1
;; 2
;;=&amp;gt; 3
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9052/binding-macro-wraps-body-in-try-not-do?show=9053#a9053</guid>
<pubDate>Tue, 21 Jan 2020 20:18:10 +0000</pubDate>
</item>
<item>
<title>Answered: Macros and dynamic vars</title>
<link>https://ask.clojure.org/index.php/8913/macros-and-dynamic-vars?show=8914#a8914</link>
<description>&lt;p&gt;&lt;code&gt;binding&lt;/code&gt; affects &lt;em&gt;runtime&lt;/em&gt;. Macros are generally expanded at read time. When you use &lt;code&gt;macroexpand&lt;/code&gt;, you are explicitly expanding the macro as part of runtime operations (so the &lt;code&gt;binding&lt;/code&gt; affects it).&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8913/macros-and-dynamic-vars?show=8914#a8914</guid>
<pubDate>Fri, 29 Nov 2019 21:31:04 +0000</pubDate>
</item>
<item>
<title>Answered: Macros cannot reliably detect usage of locals</title>
<link>https://ask.clojure.org/index.php/2814/macros-cannot-reliably-detect-usage-of-locals?show=3210#a3210</link>
<description>Reference: &lt;a href=&quot;https://clojure.atlassian.net/browse/CLJ-1997&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;https://clojure.atlassian.net/browse/CLJ-1997&lt;/a&gt; (reported by gfredericks)</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/2814/macros-cannot-reliably-detect-usage-of-locals?show=3210#a3210</guid>
<pubDate>Wed, 26 Jun 2019 12:00:00 +0000</pubDate>
</item>
<item>
<title>Answered: Adding condp-&gt; and condp-&gt;&gt; macros to core library</title>
<link>https://ask.clojure.org/index.php/2365/adding-condp-and-condp-macros-to-core-library?show=2487#a2487</link>
<description>Reference: &lt;a href=&quot;https://clojure.atlassian.net/browse/CLJ-1534&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;https://clojure.atlassian.net/browse/CLJ-1534&lt;/a&gt; (reported by kul)</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/2365/adding-condp-and-condp-macros-to-core-library?show=2487#a2487</guid>
<pubDate>Wed, 26 Jun 2019 12:00:00 +0000</pubDate>
</item>
<item>
<title>Answered: clojure.walk.macroexpand-all will not properly expand macros that depend on &amp;env</title>
<link>https://ask.clojure.org/index.php/1155/clojure-walk-macroexpand-will-properly-expand-macros-depend?show=1301#a1301</link>
<description>Reference: &lt;a href=&quot;https://clojure.atlassian.net/browse/CLJ-2011&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2011&lt;/a&gt; (reported by alex+import)</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/1155/clojure-walk-macroexpand-will-properly-expand-macros-depend?show=1301#a1301</guid>
<pubDate>Wed, 26 Jun 2019 12:00:00 +0000</pubDate>
</item>
</channel>
</rss>