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

clojure.core.reducers/fold broken

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.)

Environment

None

Status

Assignee

Unassigned

Reporter

Jonas De Vuyst

Labels

None

Approval

None

Patch

Code and Test

Priority

Minor