ru <soro...@oogis.ru> writes: Hi Ru,
> 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 Alan already told you that this solution is not really good. It works only if the operands are number literals. > 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. The macro doesn't evaluate its arguments, but it creates an expansion that looks roughly like (let [[x op y] (5 + 6)] ...). In this macro-generated code, (5 + 4) is evaluated at runtime, and then the exception is thrown. So its not that defmacro evals its args, but your macro creates code that blows up at runtime. Bye, Tassilo -- 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