Documentation ¶
Index ¶
- func Collect[S any, T any](s []S, f func(S) T) (r []T)
- func Contains[T comparable](s []T, x T) bool
- func Equal[T comparable](s []T, t []T) bool
- func EqualBy[S any, T any](s []S, t []T, f func(S, T) bool) bool
- func Remove[T comparable](s []T, x T) (r []T)
- func Reverse[T any](s []T) (r []T)
- func Sort[T Orderable](s []T) []T
- func SortBy[T any](s []T, f func(x, y T) bool) (r []T)
- func Uniq[T comparable](s []T) (r []T)
- type Orderable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Remove ¶
func Remove[T comparable](s []T, x T) (r []T)
Remove all occurrences of given element from slice (and return new slice; old slice remains unchanged).
func SortBy ¶
Sort slice by given comparator function. The comparator function f(x,y) must return true if x is larger than y, and false if x is smaller than y; the return value in case of equality does not matter (may be true or false).
func Uniq ¶
func Uniq[T comparable](s []T) (r []T)
Remove duplicates from slice of comparable elements.
Types ¶
Click to show internal directories.
Click to hide internal directories.