Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: None
    • Labels:
      None
    • Patch:
      Code and Test

      Description

      clojure.core.reducers/fold currently does not work correctly if both a reducef and combinef are passed as arguments.

      It is expected that (r/fold + + [1 2 3]) would return 6 (as do (r/fold + [1 2 3]) and (r/reduce + [1 2 3])). However, this is not the case because reducers.cljs currently defines fold as follows:

      (def fold reduce)

      As a result, the second + is used as the initial value for the reduce operation (instead of the value returned by ).

      The attached patch fixes this bug. It also adds support for the protocol CollFold in CLJS.

      (I will send in the CA tomorrow.)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jdevuyst Jonas De Vuyst
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: