Mistake in Java translation in clojure.core.reducers/fold
Fold will fail in the following example:
user=> (require '[clojure.core.reducers :as r])
user=> (r/fold + (vec (range 0 10000)))
InvalidCastException Unable to cast object of type 'clojure/core/reducers$foldvecfn_22973_22977' to type 'System.Func`1[System.Object]'. clojure/core/reducers/fjtask--22518 (reducers.clj:73)
Please take a look at reducers.clj.
When the function foldvec calls fjtask it passes in a IFn, not a Func. Func is required by System.Threading.Task's ctor. Create the Func using sys-func. A .Net 4.0 build will throw the following exception without this change.
Fixed in 1.7
Commit d75fe19, 2015.05.10
Comment made by: davidomeara
An IFn in Java implements Callable, which prevents this problem in Java. In C# there is no equivalent.