std.foldl1, std.foldr1
Open
stdlib
- Dominant language
- Jsonnet
- Stars
- 7.6k
- Forks
- 475
- PR merge metrics
- No merged PRs in 30d
Description
Fold variants which use first/last element as the starting value of the accumulator.
E.g. `sum(arr):: std.foldl1(function(x, y) x + y, arr)`.
In this case it's not hard to come up with a valid neutral element (0) and use the regular `fold`. But sometimes it can be awkward and/or inefficient.
Contributor guide
Assessment
This issue has not been assessed yet.