Documentation ¶
Index ¶
- func All[T any](s iter.Seq[T], f func(T) bool) bool
- func Any[T any](s iter.Seq[T], f func(T) bool) bool
- func Count[T any](s iter.Seq[T], f func(T) bool) int
- func Filter[T any](s iter.Seq[T], f func(T) bool) iter.Seq[T]
- func FilterToSlice[T any](s iter.Seq[T], f func(T) bool) []T
- func Find[T any](s iter.Seq[T], f func(T) bool) (int, T)
- func GroupBy[T any, K comparable, V any](s iter.Seq[T], kv func(T) (K, V)) map[K][]V
- func Map[T any, U any](is iter.Seq[T], f func(T) U) iter.Seq[U]
- func MapToSlice[T any, U any](is iter.Seq[T], f func(T) U) []U
- func MapUnique[T any, U comparable](is iter.Seq[T], f func(T) U) iter.Seq[U]
- func MapUniqueToSlice[T any, U comparable](is iter.Seq[T], f func(T) U) []U
- func Partition[T any](s iter.Seq[T], predicate func(T) bool) (trueGroup iter.Seq[T], falseGroup iter.Seq[T])
- func PartitionConsEq[T any](s iter.Seq[T], eq func(a, b T) bool) iter.Seq[[]T]
- func PartitionConsEqToSlice[T any](s iter.Seq[T], eq func(a, b T) bool) [][]T
- func PartitionToSlice[T any](s iter.Seq[T], predicate func(T) bool) (trueGroup []T, falseGroup []T)
- func Reduce[T any, A any](s iter.Seq[T], a A, f func(T, A) A) A
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
All returns true if all elements in s satisfy the predicate f. If s is nil or empty, All returns true.
func Any ¶
Any returns true if any element in the sequence satisfies the predicate, false otherwise. If the sequence is nil or empty, Any returns false.
func Filter ¶
Filter returns a new sequence containing only the elements of sequence 's' that satisfy the predicate f.
func FilterToSlice ¶
FilterToSlice returns a new slice containing only the elements of sequence 's' that satisfy the predicate f.
func Find ¶
Find returns the index and the element of the first element in the sequence that satisfies the predicate f. If no element satisfies the predicate, Find returns -1 and the zero value of the element type.
func GroupBy ¶
func GroupBy[T any, K comparable, V any](s iter.Seq[T], kv func(T) (K, V)) map[K][]V
GroupBy groups the elements of the sequence s by the key returned by the function kv.
func MapToSlice ¶
MapToSlice applies a function to each element of a sequence and returns a new slice.
func MapUnique ¶
MapUnique applies a function to each element of a sequence and returns a new sequence with unique elements only.
func MapUniqueToSlice ¶
func MapUniqueToSlice[T any, U comparable](is iter.Seq[T], f func(T) U) []U
MapUniqueToSlice applies a function to each element of a sequence and returns a new slice with unique elements only.
func Partition ¶
func Partition[T any](s iter.Seq[T], predicate func(T) bool) (trueGroup iter.Seq[T], falseGroup iter.Seq[T])
Partition returns two sequences, the first sequence contains all elements that satisfy the predicate, and the second sequence contains all elements that do not satisfy the predicate.
func PartitionConsEq ¶
PartitionConsEq returns a sequence of slices of consecutive equal elements.
func PartitionConsEqToSlice ¶
PartitionConsEqToSlice returns a slice of slices of consecutive equal elements.
func PartitionToSlice ¶
PartitionToSlice returns two slices, the first slice contains all elements that satisfy the predicate, and the second slice contains all elements that do not satisfy the predicate.
Types ¶
This section is empty.