iterx

package module
v0.0.0-...-0cd1cf3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[V any](in iter.Seq[V], filterfn func(V) bool) iter.Seq[V]

func Filter2

func Filter2[K, V any](in iter.Seq2[K, V], filterfn func(K, V) bool) iter.Seq2[K, V]

func FilterErr

func FilterErr[V any](in iter.Seq[V], filterfn func(V) (bool, error)) iter.Seq2[V, error]

func HandleError

func HandleError[V, R any](erriter iter.Seq2[V, error], fn func(iter.Seq[V]) R) (r R, err error)

func Map11

func Map11[A, B any](in iter.Seq[A], mapfn func(A) B) iter.Seq[B]

func Map12

func Map12[A, B, C any](in iter.Seq[A], mapfn func(A) (B, C)) iter.Seq2[B, C]

func Map21

func Map21[A, B, C any](in iter.Seq2[A, B], mapfn func(A, B) C) iter.Seq[C]

func Map22

func Map22[A, B, C, D any](in iter.Seq2[A, B], mapfn func(A, B) (C, D)) iter.Seq2[C, D]

func SliceCollectError

func SliceCollectError[E any](seq iter.Seq2[E, error]) ([]E, error)

func SliceSortedError

func SliceSortedError[E cmp.Ordered](seq iter.Seq2[E, error]) ([]E, error)

func SliceSortedFuncError

func SliceSortedFuncError[E cmp.Ordered](seq iter.Seq2[E, error], cmp func(E, E) int) ([]E, error)

func StopOnError

func StopOnError[V any](erriter func(yield func(V) bool) error) iter.Seq2[V, error]

Types

type GeneratorResult

type GeneratorResult[R any] func() (R, error)

GeneratorResult is the result of a generator. Calling it will block until the associated iterator has finished.

func Generator

func Generator[V, R any](gf func(yield func(V) bool) (R, error)) (iter.Seq[V], GeneratorResult[R])

Generator is an iterator that can have a final result.

func Generator2

func Generator2[K, V, R any](gf func(yield func(K, V) bool) (R, error)) (iter.Seq2[K, V], GeneratorResult[R])

Generator2 is just like Generator except it allows the iterator to have 2 values for iter.Seq2

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL