Documentation
¶
Index ¶
- func Collect[E any, C any](seq iter.Seq[E], collector Collector[E, C]) C
- type Collector
- func Distinct[E comparable]() Collector[E, iter.Seq[E]]
- func DistinctFunc[E any](f func(E, E) int) Collector[E, iter.Seq[E]]
- func GroupBy[E any, K comparable](f func(E) K) Collector[E, iter.Seq[tuple.Pair[K, iter.Seq[E]]]]
- func Partition[E any](f func(E) bool) Collector[E, tuple.Pair[iter.Seq[E], iter.Seq[E]]]
- func ToMap[E any, K comparable, V any](f func(E) (K, V)) Collector[E, map[K]V]
- func ToOrderedMap[E any, K cmp.Ordered, V any](f func(E) (K, V)) Collector[E, *ordered.Map[K, V]]
- func ToOrderedMapFunc[E, K, V any](cmp func(K, K) int, f func(E) (K, V)) Collector[E, *ordered.Map[K, V]]
- func ToOrderedSet[E any, V cmp.Ordered](f func(E) V) Collector[E, *ordered.Set[V]]
- func ToOrderedSetFunc[E, V any](cmp func(V, V) int, f func(E) V) Collector[E, *ordered.Set[V]]
- func ToSlice[E any]() Collector[E, []E]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Collector ¶
Collector collect all elements in iter.Seq to dest type.
func Distinct ¶
func Distinct[E comparable]() Collector[E, iter.Seq[E]]
Distinct remove duplicated elements in iter.Seq and returns a new iter.Seq which elements yield in visit order.
func DistinctFunc ¶
DistinctFunc remove duplicated elements in iter.Seq and returns a new iter.Seq which elements yield in visit order.
func Partition ¶
Partition creates two iter.Seq, split by the given predicate function.
The first iter.Seq contains elements that satisfies the predicate. The second iter.Seq
func ToMap ¶
func ToMap[E any, K comparable, V any](f func(E) (K, V)) Collector[E, map[K]V]
ToMap collects all elements in iter.Seq to map.
func ToOrderedMap ¶
func ToOrderedMapFunc ¶
func ToOrderedMapFunc[E, K, V any](cmp func(K, K) int, f func(E) (K, V)) Collector[E, *ordered.Map[K, V]]
ToOrderedMapFunc collects all elements in iter.Seq to ordered map.
func ToOrderedSet ¶
func ToOrderedSetFunc ¶
ToOrderedSetFunc collects all elements in iter.Seq to ordered set.
Click to show internal directories.
Click to hide internal directories.