Documentation
¶
Overview ¶
Package stateless defines a stateless (pure) iterator, i.e. one that can be iterated over multiple times without side effects, it is threadsafe
Index ¶
- func Ap[V, U any](ma Iterator[U]) func(Iterator[func(U) V]) Iterator[V]
- func Chain[U, V any](f func(U) Iterator[V]) func(Iterator[U]) Iterator[V]
- func Compress[U any](sel Iterator[bool]) func(Iterator[U]) Iterator[U]
- func DropWhile[U any](pred func(U) bool) func(Iterator[U]) Iterator[U]
- func Filter[U any](f func(U) bool) func(ma Iterator[U]) Iterator[U]
- func FilterMap[U, V any](f func(U) O.Option[V]) func(ma Iterator[U]) Iterator[V]
- func Map[U, V any](f func(U) V) func(ma Iterator[U]) Iterator[V]
- func Monoid[U any]() M.Monoid[Iterator[U]]
- func Reduce[U, V any](f func(V, U) V, initial V) func(Iterator[U]) V
- func Scan[FCT ~func(V, U) V, U, V any](f FCT, initial V) func(ma Iterator[U]) Iterator[V]
- func Take[U any](n int) func(ma Iterator[U]) Iterator[U]
- func ToArray[U any](u Iterator[U]) []U
- func Uniq[A any, K comparable](f func(A) K) func(as Iterator[A]) Iterator[A]
- func Zip[A, B any](fb Iterator[B]) func(Iterator[A]) Iterator[T.Tuple2[A, B]]
- type Iterator
- func Count(start int) Iterator[int]
- func Cycle[U any](ma Iterator[U]) Iterator[U]
- func Empty[U any]() Iterator[U]
- func Flatten[U any](ma Iterator[Iterator[U]]) Iterator[U]
- func From[U any](data ...U) Iterator[U]
- func FromArray[U any](as []U) Iterator[U]
- func MakeBy[FCT ~func(int) U, U any](f FCT) Iterator[U]
- func MonadAp[V, U any](fab Iterator[func(U) V], ma Iterator[U]) Iterator[V]
- func MonadChain[U, V any](ma Iterator[U], f func(U) Iterator[V]) Iterator[V]
- func MonadMap[U, V any](ma Iterator[U], f func(U) V) Iterator[V]
- func Of[U any](a U) Iterator[U]
- func Repeat[U any](n int, a U) Iterator[U]
- func Replicate[U any](a U) Iterator[U]
- func StrictUniq[A comparable](as Iterator[A]) Iterator[A]
- func ZipWith[FCT ~func(A, B) C, A, B, C any](fa Iterator[A], fb Iterator[B], f FCT) Iterator[C]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compress ¶ added in v1.0.13
Compress returns an Iterator that filters elements from a data Iterator returning only those that have a corresponding element in selector Iterator that evaluates to `true`. Stops when either the data or selectors iterator has been exhausted.
func DropWhile ¶ added in v1.0.13
DropWhile creates an Iterator that drops elements from the Iterator as long as the predicate is true; afterwards, returns every element. Note, the Iterator does not produce any output until the predicate first becomes false
func Map ¶
Map transforms an Iterator of type [U] into an Iterator of type [V] via a mapping function
func Scan ¶ added in v1.0.12
Scan takes an Iterator and returns a new Iterator of the same length, where the values of the new Iterator are the result of the application of `f` to the value of the source iterator with the previously accumulated value
Types ¶
type Iterator ¶
Iterator represents a stateless, pure way to iterate over a sequence
func Count ¶ added in v1.0.13
Count creates an Iterator containing a consecutive sequence of integers starting with the provided start value
func Cycle ¶ added in v1.0.13
DropWhile creates an Iterator that drops elements from the Iterator as long as the predicate is true; afterwards, returns every element. Note, the Iterator does not produce any output until the predicate first becomes false
func MakeBy ¶
MakeBy returns an Iterator with an infinite number of elements initialized with `f(i)`
func MonadMap ¶
MonadMap transforms an Iterator of type [U] into an Iterator of type [V] via a mapping function
func Repeat ¶ added in v1.0.13
Repeat creates an Iterator containing a value repeated the specified number of times. Alias of Replicate
func Replicate ¶
Replicate creates an Iterator containing a value repeated an infinite number of times.
func StrictUniq ¶ added in v1.0.11
func StrictUniq[A comparable](as Iterator[A]) Iterator[A]
StrictUniq converts an Iterator or arbitrary items into an Iterator or unique items where uniqueness is determined by the built-in uniqueness constraint