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 that's a leaky
 abstraction.


Agreed, looks like a bug to me. I'll see if I can fix it in the
separate clj-ds project, which you can then use until there is an
official clojure fix.

Karl



 On Apr 30, 10:57 am, Ken Wesson kwess...@gmail.com wrote:



  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 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 before calling
   transient?

   I'm on clojure 1.3.0-alpha4

   Check this out:http://clojure.org/Transients

  There is no mention of subvec on that page.

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


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 assuming I lose all the performance benefits of subvec if I
 defensively pour all vectors into a new vector before calling
 transient?

 I'm on clojure 1.3.0-alpha4

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


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, 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 assuming I lose all the performance benefits of subvec if I
  defensively pour all vectors into a new vector before calling
  transient?

  I'm on clojure 1.3.0-alpha4

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


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 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 before calling
 transient?

 I'm on clojure 1.3.0-alpha4

 Check this out: http://clojure.org/Transients

There is no mention of subvec on that page.

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


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 kwess...@gmail.com wrote:
 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 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 before calling
  transient?

  I'm on clojure 1.3.0-alpha4

  Check this out:http://clojure.org/Transients

 There is no mention of subvec on that page.

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