Use macroexpand-1 to expand a call to this macro, and it should be
clear what is going on.  The expanded code tries to call 5 as a
function.  What you are probably trying to do here is make (5 + 2) a
list, not a function call.

;; (note the unquote splicing of e)

(defmacro infix [e] `(let [[x# f# y#] (list ~@e)] (f# x# y#)))


2011/9/26 Aaron Cohen <aa...@assonance.org>:
>
>
> 2011/9/26 ru <soro...@oogis.ru>
>>
>> That's exactly means evaluation of argument that's contradict to
>> mentioned above documentation!
>>
>> On 26 сен, 18:18, Tassilo Horn <tass...@member.fsf.org> wrote:
>> > > Ok, this is working! But, what's the difference?
>> >
>> > Your code:
>> >
>> >   user=> (defmacro infix [e] `(let [[x# f# y#] ~e] (f# x# y#)))
>> >
>> > The ~e evaluates the given form, which looks like a function but is not.
>> >
>>
> In other words, your version of infix expands to approximately: (let [x_1
> f_2 y_3] (5 + 4)] (f_2 x_1 y_3)) and the destructuring in "let" is what
> causes the problem at runtime.
>
> --
> 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 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

Reply via email to