Fork me on GitHub
#clojure-dev
<
2017-08-26
>
nathanmarz13:08:26

user=> (def v [1 2 3 4 5])
#'user/v
user=> (def v2 (subvec v 1 3))
#'user/v2
user=> (reduce-kv (fn [r i e] ) nil v)
nil
user=> (reduce-kv (fn [r i e] ) nil v2)

IllegalArgumentException No implementation of method: :kv-reduce of protocol: #'clojure.core.protocols/IKVReduce found for class: clojure.lang.APersistentVector$SubVector  clojure.core/-cache-protocol-fn (core_deftype.clj:568)

nathanmarz13:08:09

Is this behavior intended or would this be considered a bug?

gfredericks13:08:11

seems like a bug to me. I worked on the subvec stuff a while back and can't think of any reason why it couldn't easily implement the reducy protocols

gfredericks13:08:33

(or at worst fallback to a generic seq impl)

nathanmarz14:08:18

looks like there's already a ticket for this https://dev.clojure.org/jira/browse/CLJ-2065

gfredericks14:08:06

oh I missed the kv aspect of this. maybe there's no such thing as a seq fallback in that case