Accessing a local from one macro in another executed in the scope of the let.
Posted
by Rayne
on Stack Overflow
See other posts from Stack Overflow
or by Rayne
Published on 2010-04-28T06:57:54Z
Indexed on
2010/04/28
7:03 UTC
Read the original article
Hit count: 213
Be gentle, as my macrofoo is weak.
What I'd like to do is something like this:
(defmacro foo [x] (dosync (alter x# conj x)))
(defmacro bar [] (let [x# (ref [])] (foo 3)))
Is this possible? I can't just (let [x ..] ..)
because of symbol capturing.
NOTE: I'm aware this example is trivial and not macro-worthy, but it's the simplest example I could come up with.
© Stack Overflow or respective owner