From f20942c5055e111c201acb7d3fd6103336fb0cb6 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sun, 6 Sep 2020 21:39:49 +0200 Subject: [PATCH] Update Reduction operation. Pass the Iterator as fourth argument. --- src/Operation/Reduction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Operation/Reduction.php b/src/Operation/Reduction.php index dec568cc3..d7df3a626 100644 --- a/src/Operation/Reduction.php +++ b/src/Operation/Reduction.php @@ -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)); } }; };