reduce no longer uses the IReduce interface on except on chunked
sequences perhaps it could be changed to once again take
of this on things like PersistentList and Range.
something like:
(defn reduce
([f coll]
(let [s (seq coll)]
(if s
(reduce f (first s) (next s))
(f))))
([f val coll]
(let [s (seq coll)]
(if s
(cond (chunked-seq? s)
(recur f
(.reduce (chunk-first s) f val)
(chunk-next s))
(instance? clojure.lang.IReduce s)
(.reduce #^clojure.lang.IReduce s f val)
:else (recur f (f val (first s)) (next s)))
val))))
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en