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

use pairwise order for mapreduce on arbitrary iterators #52397

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplification
  • Loading branch information
stevengj committed Dec 5, 2023
commit c783ea35b28ac2f37a21eaa8306e84195cc69b6e
2 changes: 1 addition & 1 deletion base/reduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ mapreduce_impl(f, op, A::AbstractArrayOrBroadcasted, ifirst::Integer, ilast::Int
# implements an index-free in-order pairwise strategy:
function mapreduce_impl(f, op, nt, itr)
it = iterate(itr)
it === nothing && return nt isa _InitialValue ? reduce_empty_iter(_xfadjoint(BottomRF(op), Generator(f, itr))...) : nt
it === nothing && return nt isa _InitialValue ? reduce_empty_iter(_xfadjoint(op, Generator(f, itr))...) : nt
a1, state = it
it = iterate(itr, state)
it === nothing && return nt isa _InitialValue ? mapreduce_first(f, op, a1) : op(nt, f(a1))
Expand Down
Loading