2009/10/25 jsrodrigues <john.s.r...@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