// Reduce applies the provided function against an accumulator and each element in the array (from left to right) to reduce it to a single value.
Reduce applies the provided function against an accumulator and each element in the array (from left to right) to reduce it to a single value.
// Reduce applies the provided function against an accumulator and each element in the array ( from left to right ) to reduce it to a single value .
func Reduce(s []int64, f func(sum, value int64) int64, neutral int64) int64 {
	res := neutral
	for _, e := range s {
		res = f(res, e)
	}
	return res
}
func Reduce ( s [ ] int64 , f func ( sum , value int64 ) int64 , neutral int64 ) int64 { res := neutral for _ , e := range s { res = f ( res , e ) } return res }
Reduce applies the provided function against an accumulator and each element in the array (from left to right) to reduce it to a single value.
Reduce applies the provided function against an accumulator and each element in the array ( from left to right ) to reduce it to a single value .