Documentation
¶
Index ¶
- func Contains[T comparable](slice []T, element T) bool
- func Filter[T any](slice []T, predicate function.Predicate[T]) []T
- func ForEach[T any](ctx context.Context, slice []T, consumer function.Consumer[T])
- func Map[S any, T any](ctx context.Context, slice []S, fn function.Function[S, T]) []T
- func Reduce[T any](slice []T, operator function.Operator[T]) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](slice []T, element T) bool
Contains reports whether element is present in slice. Thin wrapper around the stdlib slices.Contains so callers can keep using this package consistently.
func Filter ¶
Filter returns a new slice containing only the elements that satisfy predicate. The result is preallocated to the input length to avoid repeated growth in the common case where most elements pass.
func ForEach ¶
ForEach applies consumer to each element of slice, fanning out up to NumCPU goroutines. It returns when every element has been processed or ctx is cancelled; in the cancelled case in-flight goroutines are still awaited.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.