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 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 capture its input, F#. I unquote to do my iterative 
> processing, then I quote again to emit my macro output.
>
> If I macroexpand this:
> (clojure.pprint/pprint  (macroexpand '(a-macro (1 2 3))))
>
> I get :
>
> (fn*
>  ([f__11552__auto__]  
>   ((clojure.core/* (:val f__11551__auto__) 1)
>    (clojure.core/* (:val f__11551__auto__) 2)
>    (clojure.core/* (:val f__11551__auto__) 3))))
>
> And I have a problem. The auto gensym for args declaration (...11522) is 
> different from the gensyms applying this arg in my generated function body 
> (...11551), so I cannot call my function.
>
> Any Idea why is that? And Can you please help me to sort this kind of 
> situation?
>
> Thank you;
>
> Rafik
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to