Documentation
¶
Index ¶
- func Diff[A ~[]S, S comparable](a, b A) (A, A)
- func Map[A ~[]S, S interface{}, V interface{}](arr A, mapFn func(S) V) []V
- func Select[A ~[]S, S interface{}](arr A, cmp func(S) bool) A
- func SliceToMap[K ~[]S, S interface{}, V comparable](arr K, keyFn func(S) V) map[V]S
- func SortedEqual[A ~[]S, S cmp.Ordered](a, b A) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diff ¶
func Diff[A ~[]S, S comparable](a, b A) (A, A)
Diff returns elements in a not in b and vice versa
func Map ¶
func Map[A ~[]S, S interface{}, V interface{}](arr A, mapFn func(S) V) []V
Map returns mapping of arr using mapFn
func Select ¶
func Select[A ~[]S, S interface{}](arr A, cmp func(S) bool) A
Select returns elements of arr where cmp(element)==true
func SliceToMap ¶
func SliceToMap[K ~[]S, S interface{}, V comparable](arr K, keyFn func(S) V) map[V]S
SliceToMap returns map[keyFn(v)] = v for each v in arr
func SortedEqual ¶
SortedEqual returns true if a and b are equal if sorted
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.