Documentation ¶
Index ¶
- func Filter[T any](slice []T, fn func(v T) bool) []T
- func Map[T, U any](slice []T, init U, fn func(accum U, v T) U) U
- func Reduce[T any](slice []T, fn func(accum T, current T) T) optionext.Option[T]
- func Retain[T any](slice []T, fn func(v T) bool) []T
- func Reverse[T any](slice []T)
- func Sort[T any](slice []T, less func(i T, j T) bool)
- func SortStable[T any](slice []T, less func(i T, j T) bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
Filter filters out the elements specified by the function.
This shuffles and returns the retained values of the slice.
func Map ¶
func Map[T, U any](slice []T, init U, fn func(accum U, v T) U) U
Map maps a slice of []T -> []U using the map function.
func Reduce ¶
Reduce reduces the elements to a single one, by repeatedly applying a reducing function.
func Retain ¶
Retain retains only the elements specified by the function.
This shuffles and returns the retained values of the slice.
func Sort ¶
Sort sorts the sliceWrapper x given the provided less function.
The sort is not guaranteed to be stable: equal elements may be reversed from their original order.
For a stable sort, use SortStable.
func SortStable ¶
SortStable sorts the sliceWrapper x using the provided less function, keeping equal elements in their original order.
Types ¶
This section is empty.