HandySwift
HandySwift copied to clipboard
Make the `.sum` function more generic
Problem Statement
Currently only works on Numeric types.
Suggested Solution
Could be made available for all AdditiveArithmetic types:
extension Sequence where Element: AdditiveArithmetic {
public func sum() -> Element {
reduce(.zero, +)
}
}
Also, a predicate could be added like suggested here.