Chad Harrington wrote:
> I have a newbie question about anonymous functions.  Why does the first form
> below work and the second form does not?
>
> user> ((fn [] "foo"))
> "foo"
>
> user> (#("foo"))
> ; Evaluation aborted.

fn and #() are not interchangeable. In the first example, you simply
return "foo". However, #("foo") expands to (fn [] ("foo")), so you end
up calling a string, which of course fails.

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