> I was experimenting with transients, and they don't seem to work for
> sorted collections:
> 
> user=> (transient (sorted-map 1 2 3 4))
> java.lang.ClassCastException: clojure.lang.PersistentTreeMap cannot be
> cast to clojure.lang.IEditableCollection (NO_SOURCE_FILE:0)
> 
> user=> (transient (sorted-set 1 2 3 4))
> java.lang.ClassCastException: clojure.lang.PersistentTreeSet cannot be
> cast to clojure.lang.IEditableCollection (NO_SOURCE_FILE:0)
> 
> Is this desired behavior?

>From http://clojure.org/transients :

"Currently only vectors are supported, and note that not all Clojure data 
structures can support this feature, but most will. Lists will not, as there is 
no benefit to be had."

That appears a bit out of date given these grep results on master:

public class PersistentArrayMap extends APersistentMap implements 
IEditableCollection {
public class PersistentHashMap extends APersistentMap implements 
IEditableCollection {
public class PersistentVector extends APersistentVector implements 
IEditableCollection{
public class PersistentHashSet extends APersistentSet implements 
IEditableCollection {

It looks to me like PersistentTreeMap and PersistentTreeSet have just not yet 
been extended to support transients.

--Steve

-- 
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