Mathematical sum function
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 79
Description
**Is your feature request related to a problem? Please describe.**
Each year I try to solve a few advent-of-code problems with Bicep to see how far one can get. I noticed there is no `sum()` function. I am sure this function can come in handy even in real-world Bicep problems, even if I can't think of a legit use-case right now.
**Describe the solution you'd like**
I would like to have a `sum` function that sums an array of integers. Example:
```bicep
var mySum = sum([1,2,3]) // mySum = 6
```
Of course there is a `reduce` function, but for such a trivial operation a `sum` function would make more sense.
Contributor guide
Research direction
Start by reading the issue's existing reduce function reference and locate where Bicep array functions are defined and tested. The requested behavior is a sum function accepting an array of integers, with sum([1,2,3]) producing 6; completion should include coverage for that example and the relevant edge cases.
Written by the indexing model from the issue text.
Assessment
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100