@tempots/std
foldLeftArray() function
Applies a function to each element of an array, accumulating the result from left to right.
Signature:
foldLeftArray: (arr: T[], f: (acc: B, curr: T) => B, b: B) => B
Parameters
Parameter |
Type |
Description |
---|---|---|
arr |
T[] |
The array to iterate over. |
f |
(acc: B, curr: T) => B |
The function to apply to each element. |
b |
B |
The initial value of the accumulator. |
Returns: B
The accumulated result.