I'm trying to apply a function to a seq-able thing to produce a hashmap. So for instance say the function is (inc 3).
I'd like to write a function that does
[1 2 3] --> {1 4, 2 5, 3 6}
Can someone help me?
StanD.
> I'm still new to this so bear with me.
Welcome.
> I'm trying to apply a function to a seq-able thing to produce a
> hashmap. So for instance say the function is (inc 3).
> I'd like to write a function that does
>
> [1 2 3] --> {1 4, 2 5, 3 6}
>
> Can someone help me?
Here's one way:
user=> (into {} (for [i [1 2 3]] [i (+ 3 i)]))
{1 4, 2 5, 3 6}
--Steve