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}
> user=> (conj (transient {}) {:y 1})
> ClassCastException   [trace missing]
>
> I ran into the issue before and got a more comprehensible exception.
>
> ClassCastException clojure.lang.PersistentArrayMap$TransientArrayMap
> cannot be cast to clojure.lang.IPersistentCollection
> clojure.core/conj (core.clj:83)
>
> I can't explain why the exception is reported in two different versions.
>
> Should the exception be thrown? What's the rationale behind
> TransientArrayMap *not* being a IPersistentCollection?
>
> Jacek
>
> --
> Jacek Laskowski
> Functional languages (Clojure), Java EE, and IBM WebSphere -
> http://blog.japila.pl
> "Never discourage anyone who continually makes progress, no matter how
> slow." Plato
>
> --
> 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 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

Reply via email to