I suspect your repl was stale, since this doesn't work at all. By an
amusing coincidence, though, it doesn't break, just returns the wrong
answer:

user=> (defmacro infix [e] `(let [[x# f# y#] '~e] (f# x# y#)))
#'user/infix
user=> (infix (5 + 4))
4

That is, the *symbol* +, not the function +, is called as a function.
Symbols act like keywords in that they look themselves up in maps. The
"map" 5 does not contain the symbol '+, so the not-found value of 4 is
returned.

On Sep 26, 10:22 am, ru <soro...@oogis.ru> wrote:
> Thanks to all!
>
> With your help I have found the solution that coincide with Bronsa's
> (my special respect to Bronsa):
>
> user=> (defmacro infix [e] `(let [[x# f# y#] '~e] (f# x# y#)))
> #'user/infix
> user=> (infix (5 + 4))
> 9
>
> But, this solution seems to me awkward and showing that Clojure
> compiler does not handling quite strictly language specification
> requirements. I.e., this single quote compiler should substitute
> itself to fulfill requirement of unevaluation arguments of macro.
>
> Sincerely,
>   Ru

-- 
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