Completed
Details
Assignee
UnassignedUnassignedReporter
Jonas De VuystJonas De VuystPatch
Code and TestPriority
Minor
Details
Details
Assignee
Unassigned
UnassignedReporter
Jonas De Vuyst
Jonas De VuystPatch
Code and Test
Priority
Created November 27, 2013 at 6:53 AM
Updated November 29, 2013 at 10:00 PM
Resolved November 29, 2013 at 10:00 PM
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.)