On Wed, Dec 17, 2008 at 11:34 AM, Stuart Sierra
<the.stuart.sie...@gmail.com> wrote:
>
> Suggestions, based on common questions in the group:

These are good, Stuart, thanks!

Except...

> * Why doesn't #([%]) work?
>
> Answer: Because it expands to "(fn [x] ([x]))".  #() always assumes
> that the thing inside it is a function call.  [x] isn't a function, so
> ([x]) isn't a valid function call.

In fact, [x] is a function (for some meanings of "function"):
user=> (ifn? [5])
true

And you can put macro "calls" in #(), not just function calls.  I know
weren't really claiming otherwise, it's just a possible point of
confusion.

Perhaps:
Answer: Because it expands to "(fn [x] ([x]))".  #() always expands to
include parens around the expression you give it.  You might try
#(vector x) instead.

--Chouser

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