Proposal Details
Proposed to add below funcitons:
-- func Fold[A, E any](s Seq[E], init A, f func(A, E) A) A--
// Remove Fold because original proposal's `Reduce` takes an initial value.
func All[E any](s Seq[E], f func(E) bool) bool {
return Fold(s, true, func(x bool, e E) bool { return x && f(e) })
}
func Any[E any](s Seq[E], f func(E) bool) bool {
return ...
}
func None[E any](s Seq[E], f func(E) bool) bool {
return ...
}
Same as seq2.
Different from reduce, fold needs to provide an initial value