Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
Filter returns a new slice with all elements from the from the input elements for which the provided predicate function returns true.
func Map ¶
func Map[T1, T2 any](input []T1, f func(T1) T2) (output []T2)
Map returns a new slice populated with the result of calling the provided function on every element in the provided input slice.
func Reduce ¶
func Reduce[T1, T2 any](input []T1, f func(T2, T1) T2) T2
Reduce executes a provided function on each element of the slice in order, passing the return value of the previous function call on the preceding slice element. The final result of running the provided function across all slice elements is returned.
func ReduceWithInitialValue ¶
func ReduceWithInitialValue[T1, T2 any](input []T1, acc T2, f func(T2, T1) T2) T2
ReduceWithInitialValue executes a provided function on each element of the slice in order, passing the return value of the previous function call on the preceding slice element. Unlike Reduce, the initial value of the accumulator can be provided as an argument. The final result of running the provided function across all slice elements is returned.
Types ¶
This section is empty.