array_reduce()

Returns a single value that is the result of applying the lambda function to each element of the input list, starting with the first element and then repeatedly applying the lambda function to the result of the previous application and the next element of the list. When an initial value is provided, it is used as the first argument to the lambda function

Alias of list_reduce()

Arguments & returns

2 overloads

array_reduce(list, lambda[)

Scalar
Overload link listlambda[ Returns
#01 ANY[]LAMBDA ANY

array_reduce(list, lambda[, initial])

Scalar
Overload link listlambda[initial] Returns
#02 ANY[]LAMBDAANY ANY

Example

array_reduce example
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Engine example · Run to view results.

Catalog examples

SELECT
  list_reduce([1, 2, 3], (x, y) -> x + y);