Re: Help with anonymous functions

2009-10-25 Thread jsrodrigues
Thanks for the help Lauri! John On Oct 25, 10:29 am, Lauri Pesonen wrote: > Hi John, > > 2009/10/25 jsrodrigues : > > > > > When I try the following: > > user=> (into {} (map #([% (* % %)]) [1 2 3 4])) > > The #(...) form assumes that the is a function call and thus it is > implicitly wrapped i

Re: Help with anonymous functions

2009-10-25 Thread MarkSwanson
Thanks Lauri. I was stuck on this too. FYI this issue prompted me to submit a patch to improve the arity error message: http://groups.google.com/group/clojure/browse_thread/thread/de969a419a535a82 --~--~-~--~~~---~--~~ You received this message because you are s

Re: Help with anonymous functions

2009-10-25 Thread Lauri Pesonen
Hi John, 2009/10/25 jsrodrigues : > > When I try the following: > user=> (into {} (map #([% (* % %)]) [1 2 3 4])) The #(...) form assumes that the is a function call and thus it is implicitly wrapped in parens. That is, #(+ % %) becomes (fn [x] (+ x x)). So in your code the anonymous function bo

Help with anonymous functions

2009-10-25 Thread jsrodrigues
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.Illeg