We're updating the issue view to help you get more done. 

Some IReduce/IReduceInit implementors don't respect reduced

Description

Several reduce implementations don't properly respect reduced:

  • clojure.core.ArrayChunk's implementation of IChunk/reduce

  • VecSeq's impl of InternalReduce/reduce

  • APersistentVector's reduce with init doesn't unwrap reduced on last value

  • seqs of primitive arrays don't unwrap reduced on last value

  • PersistentList doesn't unwrap reduced on last value

Some examples:

1 2 3 4 user=> (transduce (take 1) conj (seq (long-array [1 2 3 4]))) #<Reduced@38f774f8: [1]> user=> (.reduce (list 1 2 3 4 5) (fn [_ a] (if (= a 5) (reduced "foo"))) 1) #<Reduced@753d01cc: "foo">

Patch: 0001-ensure-IReduce-IReduceInit-implementors-respect-redu.patch
Screened by: Alex Miller
See also: http://dev.clojure.org/jira/browse/CLJ-1537

Environment

None

Status

Assignee

Unassigned

Reporter

Nicola Mometto

Labels

None

Approval

Ok

Patch

Code and Test

Fix versions

Affects versions

Release 1.7

Priority

Major