Auto generated symbols (x# style) are only valid within a single syntax
quote form. Instead declare the symbol ahead of time, something like this:
(let [fsym (gensym "f_)]
`(fn [~fsym]
~@(for [x (range 10]
`(println ~fsym ~x
Hope this helps.
Timothy
On Wed, Aug 26, 2015
What Ambrose said and:
There is no need to use a hash for i in the for form. It is misleading
because one thinks it will become a generated symbol as part of the
generated form which is untrue.
On Wednesday, August 26, 2015 at 11:08:12 PM UTC+2, Rafik NACCACHE wrote:
>
> Suppose I have the foll
unify-gensyms from potemkin will fix this:
https://github.com/ztellman/potemkin
On Wed, Aug 26, 2015 at 2:07 PM, Rafik NACCACHE
wrote:
> Suppose I have the following macro, which generates a function that does
> some repetitive generation, let's say:
>
> (defmacro a-macro
> [m]
> `(fn [f#]
You want an explicit gensym that scopes over both positions.
(defmacro a-macro
[m]
(let [f (gensym "f)]
`(fn [~f]
~(for [i# m]
`(* (:val ~f) ~i# )
Thanks,
Ambrose
On Wed, Aug 26, 2015 at 5:07 PM, Rafik NACCACHE
wrote:
> Suppose I have the following macro, which ge
Suppose I have the following macro, which generates a function that does
some repetitive generation, let's say:
(defmacro a-macro
[m]
`(fn [f#]
~(for [i# m]
`(* (:val f#) ~i#
Note how I start with a quoted block in which I emit the fn header, and in
which I use a gensym to