You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the reduce and mapreduce implementations are left-associative, but this is not documented in the manual. For accuracy reasons (#4039) and possibly for future performance reasons (in parallel implementations), left-associativity is not necessarily the best choice. My suggestion is:
Explicitly document that the associativity of these functions is implementation-dependent and unspecified.
Provide reduce_left and mapreduce_left functions that are documented to be left-associative, for applications that need this (e.g. Monads.jl).
Perhaps skip providing a foldl equivalent higher-order function; you rightly point out that in Julia code this is probably more clearly and performantly expressed as a loop.
After confirming with @JeffBezanson that the intention was indeed for reduce to have unspecified associativity, I have patched the documentation to clarify this.
Currently, the
reduce
andmapreduce
implementations are left-associative, but this is not documented in the manual. For accuracy reasons (#4039) and possibly for future performance reasons (in parallel implementations), left-associativity is not necessarily the best choice. My suggestion is:reduce_left
andmapreduce_left
functions that are documented to be left-associative, for applications that need this (e.g. Monads.jl).cc: @StefanKarpinski, @pao
The text was updated successfully, but these errors were encountered: