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)]
                 (bit-or (bit-shift-left (aget a i) 8) (aget a (inc 
i))))))))
#'user/v
user=> (println v)
[0 1 2 3]
nil
user=> (= [0 1 2 3] v)
ClassCastException user$fn$reify__2 cannot be cast to java.util.Collection  
clojure.lang.APersistentVector.doEquiv (APersistentVector.java:88)

This is because doEquiv assumes that an instance of IPersistentVector also 
is an instance of Collection. While that may be true for standard Clojure 
data structures, this may not necessarily be the case for custom 
implementations.

Am I really the first one to attempt something like that? Am I not supposed 
to write custom implementations of standard interfaces? Should that bug be 
raised in JIRA?

Thanks,
Vincent

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to