Why does (conj (transient {}) {}) fail with CCE?

2012-08-09 Thread Jacek Laskowski
Hi, I've been digging into the sources of Clojure and found frequencies. There's the transient function and I thought I'd use it with a map and conj. Why does this fail? user= (conj {} {:y 1}) {:y 1} user= (conj (transient {}) {:y 1}) ClassCastException [trace missing] I ran into the issue

Re: Why does (conj (transient {}) {}) fail with CCE?

2012-08-09 Thread dennis zhuang
you must use conj! instead of conj. 在 2012-8-9 PM8:49,Jacek Laskowski ja...@japila.pl写道: Hi, I've been digging into the sources of Clojure and found frequencies. There's the transient function and I thought I'd use it with a map and conj. Why does this fail? user= (conj {} {:y 1}) {:y 1}

Re: Why does (conj (transient {}) {}) fail with CCE?

2012-08-09 Thread Baishampayan Ghose
On Thu, Aug 9, 2012 at 6:19 PM, Jacek Laskowski ja...@japila.pl wrote: What's the rationale behind TransientArrayMap *not* being a IPersistentCollection? A transient map can't be a persistent map at the same time. You need to use the transient version of conj, called conj! to conjoin something

Re: Why does (conj (transient {}) {}) fail with CCE?

2012-08-09 Thread Jacek Laskowski
On Thu, Aug 9, 2012 at 2:54 PM, Baishampayan Ghose b.gh...@gmail.com wrote: A transient map can't be a persistent map at the same time. You need to use the transient version of conj, called conj! to conjoin something into a transient map and then use persistent! to get a persistent version