Hi

On Fri, May 1, 2009 at 9:13 PM, Santanu <thisissant...@gmail.com> wrote:
[...]
> user> ((fn [a b] a b) 1 2)
> 2
[...]
> user> (#(%1 %2) 1 2)
> java.lang.ClassCastException: java.lang.Integer cannot be cast to
> clojure.lang.IF

This has come up before on the list, but the following should make it
clear what is happening:

user=> (macroexpand-1 '(#(%1 %2) 1 2))
((fn* [p1__1 p2__2] (p1__1 p2__2)) 1 2)

i.e. (#(%1 %2) 1 2)

is not the same as:
((fn [a b] a b) 1 2)

but rather:
((fn [a b] (a b) 1 2)

-- 
Michael Wood <esiot...@gmail.com>

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