# reduce Fold a list into a single value with an accumulator. ## Syntax
[reduce $list $initial {acc it} { body }]
## Examples
[reduce @{ 1 2 3 4 } 0 { ($acc + $it) }]     # 10
[reduce @{ "a" "b" "c" } "" { [str $acc $it] }]  # "abc"
# Find maximum
[reduce @{ 3 7 2 9 1 } 0 {
    [if ($it > $acc) { $it } { $acc }]
}]    # 9
## Parameters | Parameter | Description | |-----------|-------------| | `list` | List to reduce | | `initial` | Starting accumulator value | | `{ body }` | Lambda; `$acc` is accumulator, `$it` is current element | ## Returns Final accumulated value. ## See Also `map`, `filter`, `sum`, `each`