From 4e16f813545c6dd4ca3c7043eeccd3db8c54d3eb Mon Sep 17 00:00:00 2001
From: Dave MacLeod <56599343+Dhghomon@users.noreply.github.com>
Date: Fri, 20 Dec 2024 14:48:10 +0900
Subject: [PATCH] Better wording for array::reduce and fold (#1081)
---
src/content/doc-surrealql/functions/database/array.mdx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/content/doc-surrealql/functions/database/array.mdx b/src/content/doc-surrealql/functions/database/array.mdx
index 2023a3f1e..f207ca8db 100644
--- a/src/content/doc-surrealql/functions/database/array.mdx
+++ b/src/content/doc-surrealql/functions/database/array.mdx
@@ -830,7 +830,7 @@ RETURN array::flatten([ [1, 2], [3, 4], 'SurrealDB', [5, 6, [7, 8]] ]);
-The `array::fold` function applies an operation on an initial value plus every element in the array, returning the final result. To use `array::fold`, pass in an initial value, followed by parameter names for the current value and the next value and an operation to perform on them. If you only want to perform an operation on each item and do not need an initial value, use the [`array::reduce`](/docs/surrealql/functions/database/array#arrayreduce) function.
+The `array::fold` function returns a final value from the elements of an array by allowing an operation to be performed at each step of the way as each subsequent item in the array is encountered. To use `array::fold`, pass in an initial value, followed by parameter names for the current value and the next value and an operation to perform on them. If you only want to perform an operation on each item and do not need an initial value, use the [`array::reduce`](/docs/surrealql/functions/database/array#arrayreduce) function instead.
```surql title="API DEFINITION"
array::fold(array, initial_value, @closure) -> value
@@ -1420,7 +1420,7 @@ RETURN array::range(3, 2);
-The `array::reduce` function applies an operation on every element in the array, returning the final result. To use `array::reduce`, pass in parameter names for the current value and the next value and an operation to perform on them. If you want to have an initial value to pass in before the other items are operated on, use the [`array::fold`](/docs/surrealql/functions/database/array#arrayfold) function.
+The `array::reduce` function reduces the elements of an array to a single final value by allowing an operation to be performed at each step of the way as each subsequent item in the array is encountered. To use `array::reduce`, pass in parameter names for the current value and the next value and an operation to perform on them. If you need an initial value to pass in before the other items are operated on, use the [`array::fold`](/docs/surrealql/functions/database/array#arrayfold) function instead.
```surql title="API DEFINITION"
array::reduce(array, @closure) -> value