Uploaded image for project: 'Clojure'
  1. CLJ-1590

Some IReduce/IReduceInit implementors don't respect reduced

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: Release 1.7
    • Fix versions: Release 1.7
    • Labels:
      None
    • Approval:
      Ok
    • Patch:
      Code and Test

      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:

       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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bronsa Nicola Mometto
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: