Documentation
¶
Index ¶
- func AllOf[S ~[]E, E any](slice S, predicate func(E) bool) bool
- func ArgSort[T any](slice []T, less func(a, b T) bool) []int
- func CollectMapValues[K comparable, V any](m map[K]V) []V
- func ContainsAll[S ~[]E, E comparable](super S, sub S) bool
- func Exclude[S ~[]E, E comparable](set S, excludeElement E) S
- func Filter[T any](slice []T, predicate func(T) bool) []T
- func InplaceTake[T any](slice []T, predicate []bool) []T
- func Intersection[S ~[]E, E comparable](a S, b S) S
- func JoinStringers[T fmt.Stringer](elements []T, sep string) string
- func MergeMaps[K comparable, V any](map1, map2 map[K]V) map[K]V
- func MergeSlices[T any](slices ...[]T) []T
- func SliceDeDup[S ~[]E, E cmp.Ordered](s S) S
- func SortMapKeyForDeterminism[k cmp.Ordered, v any](m map[k]v) []k
- func SortedMap[k cmp.Ordered, v any](m map[k]v) iter.Seq2[k, v]
- func Subtraction[S ~[]E, E comparable](a S, b S) S
- func Take[T any](slice []T, predicate []bool) []T
- func TakeByIndices[T any](slice []T, indices []int) ([]T, error)
- func UnOrderedSliceEqual[S ~[]E, E cmp.Ordered](s1, s2 S) bool
- func ValueSortedByMapKey[k cmp.Ordered, v any](m map[k]v) iter.Seq[v]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectMapValues ¶
func CollectMapValues[K comparable, V any](m map[K]V) []V
func ContainsAll ¶
func ContainsAll[S ~[]E, E comparable](super S, sub S) bool
Contains reports whether all elements in sub are present in super.
func Exclude ¶
func Exclude[S ~[]E, E comparable](set S, excludeElement E) S
Exclude returns a new slice containing elements in set that are not equal to excludeElement.
func Filter ¶
Filter returns a new slice containing only elements that satisfy the predicate function. Returns nil if the input slice is empty.
func InplaceTake ¶
InplaceTake modifies the slice in place to contain only elements where the corresponding element in predicate is true. Please ensure len(slice) <= len(predicate) before calling this function.
func Intersection ¶
func Intersection[S ~[]E, E comparable](a S, b S) S
func MergeMaps ¶
func MergeMaps[K comparable, V any](map1, map2 map[K]V) map[K]V
func MergeSlices ¶
func MergeSlices[T any](slices ...[]T) []T
func SliceDeDup ¶
SliceDeDup removes duplicate elements from a slice.
func SortMapKeyForDeterminism ¶
SortMapKeyForDeterminism returns a slice of keys from a map in sorted order.
func SortedMap ¶
SortedMap returns an iterator that yields key-value pairs from a map in sorted key order
func Subtraction ¶
func Subtraction[S ~[]E, E comparable](a S, b S) S
Subtraction returns a new slice containing elements in a that are not present in b.
func Take ¶
Take returns a new slice containing elements from slice where the corresponding element in predicate is true. Please ensure len(slice) <= len(predicate) before calling this function.
func TakeByIndices ¶
func UnOrderedSliceEqual ¶
Types ¶
This section is empty.