Documentation
¶
Index ¶
- func Any[T comparable](slice []T, value T) bool
- func AnyF[T any](slice []T, fn func(T) (bool, error)) (result bool, err error)
- func FastRemove[T any](slice []T, index int) []T
- func Filter[T any](slice []T, fn func(T) (bool, error)) (result []T, err error)
- func Find[T any](slice []T, fn func(T) (bool, error)) (result T, ok bool, err error)
- func Findi[T any](slice []T, fn func(T) (bool, error)) (result int, ok bool, err error)
- func Map[TIn any, TOut any](slice []TIn, fn func(TIn) (TOut, error)) (result []TOut, err error)
- func Remove[T any](slice []T, index int) []T
- func RemoveF[T any](slice []T, fn func(T) (bool, error)) (result []T, ok bool, err error)
- func Reverse[T generics.LTGTConstraint](slice []T) error
- func Sort[T generics.LTGTConstraint](slice []T) error
- func SortF[T any](slice []T, fn func(T, T) (bool, error)) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Any ¶ added in v0.2.7
func Any[T comparable](slice []T, value T) bool
Any returns true if any element of the given slice is equal to the given value.
func AnyF ¶ added in v0.2.7
AnyF returns true if any element of the given slice satisfies the given function.
func FastRemove ¶ added in v0.3.0
FastRemove removes the element at the given index from the given slice. The order of the elements is not preserved. More efficient than Remove.
func Filter ¶
Filter returns a new slice containing only the elements of the given slice for which the given function returns true.
func Find ¶ added in v0.2.7
Find returns the first element of the given slice for which the given function returns true.
func Findi ¶ added in v0.2.7
Findi returns the index of the first element of the given slice for which the given function returns true.
func Map ¶
Map returns a new slice with the results of applying the given function to each element of the given slice.
func RemoveF ¶ added in v0.3.0
RemoveF removes the first element of the given slice for which the given function returns true.
func Reverse ¶
func Reverse[T generics.LTGTConstraint](slice []T) error
Reverse sorts the given slice in descending order. The type parameter must be a native number type.
func Sort ¶
func Sort[T generics.LTGTConstraint](slice []T) error
Sort sorts the given slice in ascending order. The type parameter must be a native number type.
Types ¶
This section is empty.