// 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 []uint32, f func(sum, value uint32) uint32, neutral uint32) uint32 {
	res := neutral
	for _, e := range s {
		res = f(res, e)
	}
	return res
}
func Reduce ( s [ ] uint32 , f func ( sum , value uint32 ) uint32 , neutral uint32 ) uint32 { 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 .