Documentation ¶
Index ¶
- func Filter[T any](slice []T, f func(T) bool) []T
- func FilterIndex[T any](slice []T, f func(int, T) bool) []T
- func FilterIndexWithErr[T any](slice []T, f func(int, T) (bool, error)) ([]T, error)
- func FilterMap[T1, T2 any](slice []T1, f func(T1) optionals.Optional[T2]) []T2
- func FilterMapIndex[T1, T2 any](slice []T1, f func(int, T1) optionals.Optional[T2]) []T2
- func FilterMapIndexWithErr[T1, T2 any](slice []T1, f func(int, T1) (optionals.Optional[T2], error)) ([]T2, error)
- func FilterMapWithErr[T1, T2 any](slice []T1, f func(T1) (optionals.Optional[T2], error)) ([]T2, error)
- func FilterWithErr[T any](slice []T, f func(T) (bool, error)) ([]T, error)
- func Map[T1, T2 any](slice []T1, f func(T1) T2) []T2
- func MapIndex[T1, T2 any](slice []T1, f func(int, T1) T2) []T2
- func MapIndexWithErr[T1, T2 any](slice []T1, f func(int, T1) (T2, error)) (rv []T2, err error)
- func MapWithErr[T1, T2 any](slice []T1, f func(T1) (T2, error)) (rv []T2, err error)
- func Reverse[T any](s []T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
Applies the predicate f to each element of slice in order, and returns those elements that satisfy f.
func FilterIndex ¶
Like Filter, but f also takes in the element's index.
func FilterIndexWithErr ¶
Like FilterWithErr, but f also takes in the element's index.
func FilterMap ¶
Applies f to each element of slice in order, removes any None results, and returns the rest.
func FilterMapIndex ¶
Like FilterMap, but f also takes in the element's index.
func FilterMapIndexWithErr ¶
func FilterMapIndexWithErr[T1, T2 any](slice []T1, f func(int, T1) (optionals.Optional[T2], error)) ([]T2, error)
Like FilterMapWithErr, but f also takes in the element's index.
func FilterMapWithErr ¶
func FilterMapWithErr[T1, T2 any](slice []T1, f func(T1) (optionals.Optional[T2], error)) ([]T2, error)
Applies f to each element of slice in order, removes any None results, and returns the rest. If f returns a non-nil error on any element, iteration immediately stops, and the error is returned.
func FilterWithErr ¶
Applies the predicate f to each element of slice in order, and returns those elements that satisfy f. If f returns a non-nil error on any element, iteration immediately stops, and the error is returned.
func Map ¶
func Map[T1, T2 any](slice []T1, f func(T1) T2) []T2
Apply f to each element of slice in order, returning the results.
func MapIndexWithErr ¶
Like MapWithErr, but f also takes in the element's index.
func MapWithErr ¶
Apply f to each element of slice in order, returning the results. If f returns a non-nil error on any element, iteration immediately stops, and the error is returned.
Types ¶
This section is empty.