Re: SubVector's (via 'subvec') do not support 'transient'

2011-05-01 Thread Krukow
On Apr 30, 8:16 pm, Nathan Sorenson n...@sfu.ca wrote: Yes but the contract of subvec is that it returns a persistent vector and the resulting data structure returns true under the vector? predicate. I know that subvec returns a different type because I've looked at the Java source code but

Re: SubVector's (via 'subvec') do not support 'transient'

2011-04-30 Thread Armando Blancas
Check this out: http://clojure.org/Transients On Apr 29, 10:54 am, Nathan Sorenson n...@sfu.ca wrote: (transient (subvec [1 2 3 4 5] 0 2)) fails with a class cast exception. Is this expected/unavoidable? How do I know whether the vectors I'm passed are regular vectors or come via subvec? I'm

Re: SubVector's (via 'subvec') do not support 'transient'

2011-04-30 Thread Nathan Sorenson
I've read that, and the claim seems to be that Vectors support transience. Within Clojure's abstraction SubVectors are Vectores: (vector? (subvec [1 2 3] 0 2)) = true. On Apr 30, 8:27 am, Armando Blancas armando_blan...@yahoo.com wrote: Check this out:http://clojure.org/Transients On Apr 29,

Re: SubVector's (via 'subvec') do not support 'transient'

2011-04-30 Thread Ken Wesson
On Sat, Apr 30, 2011 at 11:27 AM, Armando Blancas armando_blan...@yahoo.com wrote: On Apr 29, 10:54 am, Nathan Sorenson n...@sfu.ca wrote: (transient (subvec [1 2 3 4 5] 0 2)) fails with a class cast exception. Is this expected/unavoidable? How do I know whether the vectors I'm passed are

Re: SubVector's (via 'subvec') do not support 'transient'

2011-04-30 Thread Nathan Sorenson
Yes but the contract of subvec is that it returns a persistent vector and the resulting data structure returns true under the vector? predicate. I know that subvec returns a different type because I've looked at the Java source code but that's a leaky abstraction. On Apr 30, 10:57 am, Ken Wesson

SubVector's (via 'subvec') do not support 'transient'

2011-04-29 Thread Nathan Sorenson
(transient (subvec [1 2 3 4 5] 0 2)) fails with a class cast exception. Is this expected/unavoidable? How do I know whether the vectors I'm passed are regular vectors or come via subvec? I'm assuming I lose all the performance benefits of subvec if I defensively pour all vectors into a new vector