Documentation
¶
Index ¶
- func CircularSlice[T any](slice []T) iter.Seq[T]
- func CircularSlice2[T any](slice []T) iter.Seq2[int, T]
- func Fold[A any, B any](ite Iterator[A], acc B, fn func(A, B) B) B
- func ParallelFilter[T any](ite iter.Seq[T], filterFunc FilterFunc[T], maxCpuCount ...int) iter.Seq[T]
- func ParallelMap[A any, B any](ite Iterator[A], fn func(A) B, maxCpuCount ...int) iter.Seq[B]
- func RangeN(n int) iter.Seq[int]
- func Zip[A any, B any](ite1 iter.Seq[A], ite2 iter.Seq[B]) iter.Seq2[A, B]
- type FilterFunc
- type Iterator
- func (ite Iterator[T]) AdvanceBy(n int) []T
- func (ite Iterator[T]) All(fn FilterFunc[T]) bool
- func (ite Iterator[T]) Collect() []T
- func (ite Iterator[T]) Count() int
- func (ite Iterator[T]) Enumerate() Iterator2[int, T]
- func (ite Iterator[T]) Filter(fn FilterFunc[T]) Iterator[T]
- func (ite Iterator[T]) FirstN(n int) Iterator[T]
- func (ite Iterator[T]) ForEach(fn func(T))
- func (ite Iterator[T]) Intersperse(seperator T) Iterator[T]
- func (ite Iterator[T]) Last() (*T, bool)
- func (ite Iterator[T]) Nth(n int) (*T, bool)
- func (ite Iterator[T]) Partition(fn FilterFunc[T]) (trueV []T, falseV []T)
- func (ite Iterator[T]) Reduce(fn func(T, T) T) T
- type Iterator2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CircularSlice ¶
func ParallelFilter ¶
func ParallelFilter[T any](ite iter.Seq[T], filterFunc FilterFunc[T], maxCpuCount ...int) iter.Seq[T]
Does not preserve order
func ParallelMap ¶
Does not preserve order
Types ¶
type FilterFunc ¶
type Iterator ¶ added in v0.2.0
func (Iterator[T]) AdvanceBy ¶ added in v0.2.0
Moves the iterator forward by up to n elements. Returns the elements which have been passed.
func (Iterator[T]) All ¶ added in v0.2.0
func (ite Iterator[T]) All(fn FilterFunc[T]) bool
Returns if all the values in the iterator have returned true from the fn provided. Consumes the iterator.
func (Iterator[T]) Count ¶ added in v0.2.0
Returns the number of elements in the iterator, consuming it.
func (Iterator[T]) Filter ¶ added in v0.2.0
func (ite Iterator[T]) Filter(fn FilterFunc[T]) Iterator[T]
Returns the elements which return true from the fn provided.
func (Iterator[T]) Intersperse ¶ added in v0.2.0
func (Iterator[T]) Nth ¶ added in v0.2.0
Returns the nth element in the iterator, and true if the value exists. Else, returns nil and false.
func (Iterator[T]) Partition ¶ added in v0.2.0
func (ite Iterator[T]) Partition(fn FilterFunc[T]) ( trueV []T, falseV []T)
Paritions the iterator into two slices, one for the true values and one for the false values. Consumes the iterator.
Click to show internal directories.
Click to hide internal directories.