Documentation
¶
Index ¶
- func All[T any](s SliceIterator[T], predicate func(v T) bool) bool
- func Any[T any](s SliceIterator[T], predicate func(v T) bool) bool
- func Reduce[T, V any](i SliceIterator[T], initial V, reduce func(acc V, curr T) V) V
- type Enumerated
- type Enumerator
- type SliceIterator
- func Concat[T any](iters ...SliceIterator[T]) SliceIterator[T]
- func Filter[T any](s SliceIterator[T], filter func(t T) bool) SliceIterator[T]
- func Map[T, V any](s SliceIterator[T], transform func(t T) V) SliceIterator[V]
- func NewIterator[T any](s []T) SliceIterator[T]
- func Zip[T, V any](s1 []T, s2 []V) SliceIterator[Tuple[T, V]]
- type Tuple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶ added in v1.2.4
func All[T any](s SliceIterator[T], predicate func(v T) bool) bool
Returns true if all elements meet predicate
func Any ¶ added in v1.2.4
func Any[T any](s SliceIterator[T], predicate func(v T) bool) bool
Returns true if any elements meet predicate
func Reduce ¶
func Reduce[T, V any](i SliceIterator[T], initial V, reduce func(acc V, curr T) V) V
Reduce combines all elements of a iterator of type T into a single accumulated value V, starting with an initial value
Types ¶
type Enumerated ¶ added in v1.2.4
type Enumerator ¶ added in v1.2.4
type Enumerator[V any] iter.Seq[Enumerated[V]]
type SliceIterator ¶ added in v1.2.1
SliceIterator is a type definition of an iter.Seq for value of type T
func Concat ¶ added in v1.2.4
func Concat[T any](iters ...SliceIterator[T]) SliceIterator[T]
Concatenates multiple iterators into a single iterator
func Filter ¶
func Filter[T any](s SliceIterator[T], filter func(t T) bool) SliceIterator[T]
Filter iterates over a slice T and returns a new iterator containing only the elements for which the provided filter function returns true.
func Map ¶
func Map[T, V any](s SliceIterator[T], transform func(t T) V) SliceIterator[V]
Map applies a transformation function to every element of a slice T and returns a new iterator of V.
func NewIterator ¶ added in v1.2.1
func NewIterator[T any](s []T) SliceIterator[T]
NewIterator creates a SliceIterator that iterates over the elements of the provided slice s.
func Zip ¶ added in v1.2.4
func Zip[T, V any](s1 []T, s2 []V) SliceIterator[Tuple[T, V]]
Combines two slices and returns an iterator of tuples
func (SliceIterator[T]) Collect ¶ added in v1.2.1
func (i SliceIterator[T]) Collect() []T
Collect consumes the SliceIterator and returns a new slice containing all the yielded elements.
func (SliceIterator[T]) Count ¶ added in v1.2.4
func (s SliceIterator[T]) Count() int
Returns count of elements in iterator
func (SliceIterator[T]) Enumerate ¶ added in v1.2.4
func (s SliceIterator[T]) Enumerate() Enumerator[T]