Documentation ¶
Index ¶
- func AppendOrReplace[T any](slice []T, value T, fn func(T) bool) []T
- func Filter[T any](slice []T, fn func(T) bool) []T
- func Find[T any](slice []T, fn func(T) bool) (T, bool)
- func FlatMap[T, U any](slice []T, fn func(T) []U) []U
- func GroupBy[T any, K comparable](slice []T, fn func(T) K) map[K][]T
- func Map[T, U any](slice []T, fn func(T) U) []U
- func MapErr[T, U any](slice []T, fn func(T) (U, error)) ([]U, error)
- func Reduce[T, U any](slice []T, initial U, fn func(U, T) U) U
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendOrReplace ¶
AppendOrReplace appends a value to a slice if the slice does not contain a value for which the given function returns true. If the slice does contain such a value, it is replaced.
func GroupBy ¶
func GroupBy[T any, K comparable](slice []T, fn func(T) K) map[K][]T
GroupBy groups the elements of a slice by the result of a function.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.