Alan, Please forgive me. I am very sorry. May be my English is not so good. Simply, I stupidly kept the idea that macro differs from the function in that is evaluated twice, the first time with the unevaluated arguments. When I saw that even in Lisp it is not the case, I gave up : (
Sincerely, Ru On 27 сен, 23:23, Alan Malloy <a...@malloys.org> wrote: > It seems you are enjoying spewing accusations at Clojure, but if your > goal is to actually get something done, you would get a lot more out > of this discussion if your attitude were "Huh, I expected x but see y! > Is that a bug or am I wrong? Oh I see, it's not a bug? I still don't > understand, please explain". You are behaving like "OMG this is such a > bug how come nobody but me sees this obvious error in Clojure?" when > respected and experienced members of the community try to help you, an > apparent novice, with an interesting topic. This does nothing to > advance your knowledge, and frustrates the people who would otherwise > be eager to help. > > On Sep 27, 2:13 am, ru <soro...@oogis.ru> wrote: > > > > > > > > > You are right, Alan! > > > And in this case Closure compiler behave itself also unpredictably and > > quite the contrary: > > Where it must evaluate a symbol (like in this case), it doesn't. > > Where it mustn't evaluate a symbol (argument of macro), it does. > > So, need to have comprehensive and profound knowledge about its > > behavior, including subtleties, even in very simple use cases. > > Your explanation show this quite clearly. > > > On 27 сен, 02:42, Alan Malloy <a...@malloys.org> wrote: > > > > 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