Documentation ¶
Index ¶
- func Contains[K constraints.Ordered](s []K, e K) bool
- func Filter[K any](s []K, filterFunc func(K) bool) (result []K)
- func Flatten[K any](s [][]K) (result []K)
- func IndexesOf[K constraints.Ordered](s []K, e K) (indexes []int)
- func Keys[T constraints.Ordered, K any](m map[T]K) (result []T)
- func Map[K any](s []K, mapFunc func(K) K) (result []K)
- func Max[K constraints.Ordered](s []K) (result K)
- func Min[K constraints.Ordered](s []K) (result K)
- func Reduce[K any](s []K, reduceFunc func(K, K) K) (result K)
- func SplitByN[T any](s []T, n int) [][]T
- func Values[T constraints.Ordered, K any](m map[T]K) (result []K)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[K constraints.Ordered](s []K, e K) bool
Contains returns true if array of K contains e
func Filter ¶
Filter returns array with elements of s if filterFunc returned true for according element
func Flatten ¶
func Flatten[K any](s [][]K) (result []K)
Flatten returns slice based on matrix values
func IndexesOf ¶
func IndexesOf[K constraints.Ordered](s []K, e K) (indexes []int)
IndexesOf returns []int with indexes of occurrences e in array s
func Keys ¶
func Keys[T constraints.Ordered, K any](m map[T]K) (result []T)
Keys returns array of T containing keys of map[T]K
func Map ¶
func Map[K any](s []K, mapFunc func(K) K) (result []K)
Map returns array with every element of s passed through the mapFunc
func Reduce ¶
func Reduce[K any](s []K, reduceFunc func(K, K) K) (result K)
Reduce returns one K var that is result of cumulative execution of reduceFunc on every element of s
func SplitByN ¶ added in v1.0.2
SplitByN splits a slice s into sub-slices of maximum size n. Returns nil if n is less than or equal to 0.
func Values ¶
func Values[T constraints.Ordered, K any](m map[T]K) (result []K)
Values returns array of T containing values of map[T]K
Types ¶
This section is empty.