Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(un)specify associativity of reduce and mapreduce #4046

Closed
stevengj opened this issue Aug 13, 2013 · 2 comments
Closed

(un)specify associativity of reduce and mapreduce #4046

stevengj opened this issue Aug 13, 2013 · 2 comments
Labels
breaking This change will break code needs decision A decision on this change is needed

Comments

@stevengj
Copy link
Member

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

cc: @StefanKarpinski, @pao

@pao
Copy link
Member

pao commented Aug 13, 2013

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.

@stevengj
Copy link
Member Author

After confirming with @JeffBezanson that the intention was indeed for reduce to have unspecified associativity, I have patched the documentation to clarify this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change will break code needs decision A decision on this change is needed
Projects
None yet
Development

No branches or pull requests

2 participants