I have a question about into.
When you run the into against a map you get a vector of
(into [] {:a 1 :b 2})
=> [[:a 1] [:b 2]]
However when you use a for in front of this you get the full map.
(into [] (for [_ (range 1)] {:a 1 :b 2}))
=> [{:a 1, :b 2}]
Why is this? I would have expected them both to yield the same
results...
Thanks
Bassel
-Per
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe, reply using "remove me" as the subject.
>
Love the REPL.
Sean
On Apr 7, 8:45 pm, Per Vognsen <per.vogn...@gmail.com> wrote:
> The second case is equivalent to (into [] [{:a 1 :b 2}]). You're
> passing a singleton list containing a single element which happens to
> be a map.
>
> -Per
>
-Per