Skip to content

Commit

Permalink
Update Reduction operation.
Browse files Browse the repository at this point in the history
Pass the Iterator as fourth argument.
  • Loading branch information
drupol committed Sep 7, 2020
1 parent ed246ed commit f20942c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Operation/Reduction.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static function ($initial = null) use ($callback): Closure {
*/
static function (Iterator $iterator) use ($callback, $initial): Generator {
foreach ($iterator as $key => $value) {
yield $key => ($initial = $callback($initial, $value, $key));
yield $key => ($initial = $callback($initial, $value, $key, $iterator));
}
};
};
Expand Down

0 comments on commit f20942c

Please sign in to comment.