Hi,
I'm trying to find the #(...) equivalent of (fn [] ...) for the
following case:
user=> (into {} (map (fn [x] [x (* x x)]) [1 2 3 4]))
{4 16, 3 9, 2 4, 1 1}
When I try the following:
user=> (into {} (map #([% (* % %)]) [1 2 3 4]))
I get the error:
java.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong
number of args passed to: LazilyPersistentVector (NO_SOURCE_FILE:0)
I even tried the following:
user=> (macroexpand-1 '#([% (* % %)]))
And got the result from the macroexpand-1:
(fn* [p1__181] ([p1__181 (* p1__181 p1__181)]))
What am I doing wrong here?
Thanks,
John
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---