JuliaFolds / Transducers.jl

Efficient transducers for Julia
https://juliafolds.github.io/Transducers.jl/dev/
MIT License
432 stars 24 forks source link

Incorrect handling of initial value in foldxt #491

Closed jishnub closed 3 years ago

jishnub commented 3 years ago

With 2 threads,

julia> foldl(+, 1:10, init = 100)
155

julia> Transducers.foldxt(+, 1:10, init = 100)
255

Looks like init is used once on each thread

jishnub commented 3 years ago

I believe this is not the correct usage of init after reading the docs. init is expected to be the identity element for the reduction operator. This is not an issue then, although it would have been nice to have consistency with Base.