From ffcca2eb938ddef92dbbeae9223bbac09fca1f1c Mon Sep 17 00:00:00 2001 From: Jan Klass Date: Sat, 12 Jul 2025 20:46:27 +0200 Subject: [PATCH] Fix swapped closure parameters As per [`reduce` command documentation examples][reduce], the reduce closure has parameters `|it, acc|`. This accidental swap was part of the introduction of the example in #1928. [reduce]: https://www.nushell.sh/commands/docs/reduce.html --- lang-guide/chapters/types/basic_types/closure.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang-guide/chapters/types/basic_types/closure.md b/lang-guide/chapters/types/basic_types/closure.md index 0cf8eac881f..308059249fc 100644 --- a/lang-guide/chapters/types/basic_types/closure.md +++ b/lang-guide/chapters/types/basic_types/closure.md @@ -177,7 +177,7 @@ The `reduce` command processes a list to accumulate a single result. The closure [1 2 3 4] | reduce { |accumulator, current_value| $accumulator + $current_value } ``` -_Explanation:_ This sums the numbers in the list. The closure `{|accumulator, current_value| $accumulator + $current_value}` adds the `current_value` to the `accumulator`. By default, the first item is the initial accumulator, and iteration starts from the second. +_Explanation:_ This sums the numbers in the list. The closure `{|current_value, accumulator| $accumulator + $current_value}` adds the `current_value` to the `accumulator`. By default, the first item is the initial accumulator, and iteration starts from the second. **Output:**