Documentation
¶
Index ¶
- func CountFunc[T any](slice []T, predicate func(T) bool) int
- func Equals[S1 ~[]E, S2 ~[]E, E comparable](a S1, b S2) bool
- func Fill[S ~[]E, E any](slice S, value E)
- func Filter[S ~[]E, E any](source S, predicate func(E) bool) S
- func FilterInPlace[S ~[]E, E any](source *S, predicate func(E) bool)
- func FilterInPlaceStable[S ~[]E, E any](source *S, predicate func(E) bool)
- func FilterToIterable[S ~[]E, E any](source S, predicate func(E) bool) iter.Seq[E]
- func Transform[S1 ~[]E1, S2 ~[]E2, E1, E2 any](source S1, transformer func(E1) E2) S2
- func TransformInPlace[S ~[]E, E any](source S, transformer func(E) E)
- func TransformToIterable[S ~[]E1, E1, E2 any](source S, transformer func(E1) E2) iter.Seq[E2]
- func Unique[S ~[]E, E comparable](source S) S
- func UniqueInPlace[S ~[]E, E comparable](source *S)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountFunc ¶
CountFunc returns the number of elements in slice that satisfy the predicate function.
func Equals ¶
func Equals[S1 ~[]E, S2 ~[]E, E comparable](a S1, b S2) bool
Equals checks if two slices are equal both in length and content.
func Fill ¶
func Fill[S ~[]E, E any](slice S, value E)
Fill sets all elements of the slice to the specified value.
func Filter ¶
Filter returns a new slice containing only the elements of the source slice that satisfy the predicate function.
func FilterInPlace ¶
FilterInPlace modifies the source slice in place to retain only the elements that satisfy the predicate function. This function avoids additional memory allocation while not preserving the order of elements.
func FilterInPlaceStable ¶
FilterInPlaceStable modifies the source slice in place to retain only the elements that satisfy the predicate function. This function avoids additional memory allocation while preserving the order of elements.
func FilterToIterable ¶
FilterToIterable returns an iterable sequence containing only the elements of the source slice that satisfy the predicate function.
func Transform ¶
func Transform[S1 ~[]E1, S2 ~[]E2, E1, E2 any](source S1, transformer func(E1) E2) S2
Transform applies the transformer function to each element of the source slice and returns a new slice containing the results.
func TransformInPlace ¶
func TransformInPlace[S ~[]E, E any](source S, transformer func(E) E)
TransformInPlace applies the transformer function to each element of the source slice and modifies the source slice in place.
func TransformToIterable ¶
TransformToIterable applies the transformer function to each element of the source slice and returns an iterable sequence of the results.
func Unique ¶
func Unique[S ~[]E, E comparable](source S) S
Unique returns a new slice containing only the unique elements from the source slice, preserving the order of their first occurrence.
func UniqueInPlace ¶
func UniqueInPlace[S ~[]E, E comparable](source *S)
UniqueInPlace modifies the source slice in place to contain only the unique elements, preserving the order of their first occurrence.
Types ¶
This section is empty.