Try:

(defmacro infix [[x f y]] `(~f ~x ~y)))

On Mon, Sep 26, 2011 at 9:57 AM, Ruslan Sorokin <soro...@oogis.ru> wrote:

> **
> Hi dear clojurians!
>
> From Clojure documentation (http://clojure.org/evaluation):
>
> ..If the operator of a call is a symbol that names a global var that is a
> macro function, that macro function is called and is passed the *
> unevaluated* operand forms.
>
> But:
>
> ru@ru-desktop ~/clojure/clojure-1.2.1 $ java -cp clojure.jar clojure.main
> Clojure 1.2.1
> user=> (defmacro infix [e] `(let [[x# f# y#] ~e] (f# x# y#)))
> #'user/infix
> user=> (infix [5 + 4])
> 9
> user=> (infix (5 + 4))
> java.lang.ClassCastException: java.lang.Integer cannot be cast to
> clojure.lang.IFn (NO_SOURCE_FILE:0)
> user=>
>
> So, it is tried to evaluate the form (5 + 4). Is not it?
> As I remember from Lisp, UNevaluation of arguments is one of the main
> properties of macros. Am I right?
> Thank you in advance for the any explanations.
>
> 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

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