Re: ClassCastException in APersistentVector.doEquiv with custom implementation of IPersistentVector

2013-07-12 Thread Vincent
On Friday, July 12, 2013 12:01:08 AM UTC+2, Sean Corfield wrote: On Wed, Jul 10, 2013 at 11:00 AM, Vincent vhenn...@gmail.comjavascript: wrote: I guess I can proxy APersistentVector, but the Clojure docs [1] advise to use reify in favour to proxy whenever possible. My goal is to have

Re: ClassCastException in APersistentVector.doEquiv with custom implementation of IPersistentVector

2013-07-11 Thread Sean Corfield
On Wed, Jul 10, 2013 at 11:00 AM, Vincent vhenneb...@gmail.com wrote: I guess I can proxy APersistentVector, but the Clojure docs [1] advise to use reify in favour to proxy whenever possible. My goal is to have my byte stream behave like a standard Clojure vector. Given the definition of

Re: ClassCastException in APersistentVector.doEquiv with custom implementation of IPersistentVector

2013-07-10 Thread Vincent
I guess I can proxy APersistentVector, but the Clojure docs [1] advise to use reify in favour to proxy whenever possible. My goal is to have my byte stream behave like a standard Clojure vector. (Parts of that stream also represent maps, and I'd like to do the same without loading them into

Re: ClassCastException in APersistentVector.doEquiv with custom implementation of IPersistentVector

2013-07-10 Thread Cedric Greevey
If Clojure's code assumes IPersistentVectors to be Collections, why doesn't IPersistentVector extend Collection? I'd consider that to be a bug. On Wed, Jul 10, 2013 at 2:00 PM, Vincent vhenneb...@gmail.com wrote: I guess I can proxy APersistentVector, but the Clojure docs [1] advise to use

Re: ClassCastException in APersistentVector.doEquiv with custom implementation of IPersistentVector

2013-07-10 Thread Gary Trakhman
For reference, here's another vector implementation: https://github.com/clojure/clojure/blob/master/src/clj/clojure/gvec.clj On Wed, Jul 10, 2013 at 6:39 PM, Cedric Greevey cgree...@gmail.com wrote: If Clojure's code assumes IPersistentVectors to be Collections, why doesn't IPersistentVector

ClassCastException in APersistentVector.doEquiv with custom implementation of IPersistentVector

2013-07-09 Thread Vincent
Hello, Suppose I have a byte array representing an array of integers: $ clojure-repl Clojure 1.5.1 user= (def v (let [a (byte-array (map byte [0 0 0 1 0 2 0 3]))] (reify clojure.lang.IPersistentVector clojure.lang.Seqable (seq [_] (for [i (range 0 (alength a) 2)]

Re: ClassCastException in APersistentVector.doEquiv with custom implementation of IPersistentVector

2013-07-09 Thread Gary Trakhman
From the lack of extending java's Collection in IPersistentVector or associated interfaces, it seems like the intent is for every implementation to extend (proxy) APersistentVector. Is that sufficient for what you're trying to do? None of the methods in there are final. On Tue, Jul 9, 2013 at