Re: putting 2-element colls into a map: works with vectors, but not with lists?

2013-06-25 Thread Michael-Keith Bernard (SegFaultAX)
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentMap.java#L24 The implementation assumes you're attempting to conj one of the following 3 things into the hash map: 1. A MapEntry object 2. A vector of the format [key value] 3. A seq of MapEntry objects

Re: putting 2-element colls into a map: works with vectors, but not with lists?

2013-06-25 Thread Michael Gardner
On Jun 25, 2013, at 15:03 , Michael-Keith Bernard (SegFaultAX) mkbernard@gmail.com wrote: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentMap.java#L24 The implementation assumes you're attempting to conj one of the following 3 things into the hash map:

putting 2-element colls into a map: works with vectors, but not with lists?

2013-06-24 Thread John Gabriele
Why does `into` fail when the 2-element collections are lists and not vectors? : ~~~ user= (into {} [[:a 1] [:b 2]]) {:a 1, :b 2} user= (into {} ['(:a 1) '(:b 2)]) ClassCastException clojure.lang.Keyword cannot be cast to java.util.Map$Entry clojure.lang.ATransientMap.conj

Re: putting 2-element colls into a map: works with vectors, but not with lists?

2013-06-24 Thread Sean Corfield
On Mon, Jun 24, 2013 at 8:49 AM, John Gabriele jmg3...@gmail.com wrote: Why does `into` fail when the 2-element collections are lists and not vectors? : Because the implementation special cases vectors :) It's the one place where a two element vector is treated like a Map$Entry so that you are

Re: putting 2-element colls into a map: works with vectors, but not with lists?

2013-06-24 Thread John Gabriele
On Monday, June 24, 2013 12:14:56 PM UTC-4, Sean Corfield wrote: On Mon, Jun 24, 2013 at 8:49 AM, John Gabriele jmg...@gmail.comjavascript: wrote: Why does `into` fail when the 2-element collections are lists and not vectors? : Because the implementation special cases vectors :)

Re: putting 2-element colls into a map: works with vectors, but not with lists?

2013-06-24 Thread Michael Gardner
On Jun 24, 2013, at 11:14 , Sean Corfield seancorfi...@gmail.com wrote: On Mon, Jun 24, 2013 at 8:49 AM, John Gabriele jmg3...@gmail.com wrote: Why does `into` fail when the 2-element collections are lists and not vectors? : Because the implementation special cases vectors :) It's the