Documentation
¶
Index ¶
- func Clamp[T cmp.Ordered](v, lo, hi T) T
- func ClampFunc[T any](v, lo, hi T, comp func(a, b T) bool) T
- func Count[T comparable](s []T, value T) int
- func CountFunc[T any](s []T, f func(value T) bool) int
- func Filter[T any](s []T, f func(T) bool) []T
- func Map[T any, O any](s []T, f func(T) O) []O
- func MapKeys[K comparable, V any](m map[K]V) []K
- func MapValues[K comparable, V any](m map[K]V) []V
- func Merge[T cmp.Ordered](a, b []T) []T
- func MergeFunc[T any](a, b []T, comp func(x, y T) bool) []T
- func Reduce[T any, O any](s []T, init O, f func(acc O, v T) O) O
- func Rotate[T any](s []T, middle int) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
Create and return a new slice containing only the elements of s for which f returns true.
func Map ¶
Create and return a new slice filled with the results of applying function f on every element of s
func MapKeys ¶
func MapKeys[K comparable, V any](m map[K]V) []K
Create and return a new slice consisting of the keys of map m
func MapValues ¶
func MapValues[K comparable, V any](m map[K]V) []V
Create and return a new slice consisting of the values of map m
func Merge ¶
Create and return a slice consisting of the two sorted slices a and b. The result is also sorted. Elements are ordered using <
func MergeFunc ¶
Create and return a slice consisting of the two sorted slices a and b. The result is also sorted. Elements are ordered using the function comp.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.