Thanks for the help Lauri!

John

On Oct 25, 10:29 am, Lauri Pesonen <lauri.peso...@iki.fi> wrote:
> Hi John,
>
> 2009/10/25 jsrodrigues <john.s.rodrig...@gmail.com>:
>
>
>
> > 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 body becomes ([x (* x x)])
> which is broken and results in the error you are seeing. To fix this
> you need to use a function that creates a vector out of your arguments
> rather than the literal vector notation, i.e. #(vector % (* % %))
>
> user> (map #(vector % (* % %)) [1 2 3 4])
> ([1 1] [2 4] [3 9] [4 16])
>
> > John
>
> --
>   ! Lauri

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