Documentation
¶
Index ¶
- func AllOf[S ~[]E, E any](slice S, predicate func(E) bool) bool
- 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 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 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 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 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 UnOrderedSliceEqual ¶
Types ¶
This section is empty.