To add a little, into is generic and has no special treatment if the 
collection is a map, but works with maps if the elements are vectors 
because map associations of key-value pairs are a subclass of vector. The 
other way around:
user=> (for [elem {:foo :bar}] elem)
([:foo :bar]) ; extracts :foo -> :bar as a vector

On Wednesday, March 26, 2014 5:51:09 PM UTC-7, Robert Marianski wrote:

> into expects that because it is implemented with conj.
>
> > (conj {} [:foo :bar])
> {:foo :bar}
>
>
> On Wednesday, March 26, 2014 4:41:16 PM UTC-4, Michael Gardner wrote:
>>
>> For reasons unclear to me, (into {} ...) expects a sequence of 2-element 
>> *vectors*, not just 2-element collections. partition returns a seq of 
>> lists, not vectors, which is why you're getting that exception. You could 
>> try (into {} (map vec (partition 2 2 "12"))) instead. 
>>
>> On Mar 26, 2014, at 15:36 , Andy Smith <the4th...@googlemail.com> wrote: 
>>
>> > Hi all, 
>> > 
>> > I was wondering why this doesn't create a map 1 -> 2 : 
>> > 
>> > (into {} (partition 2 2 "12")) 
>> > 
>> > Must be yet another misunderstanding of mine. 
>> > 
>> > Thanks 
>> > 
>> > Andy 
>> > 
>> > -- 
>> > 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 
>> > --- 
>> > You received this message because you are subscribed to the Google 
>> Groups "Clojure" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an email to clojure+u...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/d/optout. 
>>
>>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to