iter

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 2 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func D

func D[V any](seq Seq[V]) iter.Seq[V]

func D2

func D2[K, V any](seq Seq2[K, V]) iter.Seq2[K, V]

func Fold added in v0.0.22

func Fold[A, V any](seq Seq[V], folder func(A, V) A, initial A) (acc A)

func Fold2 added in v0.0.22

func Fold2[A, K, V any](seq Seq2[K, V], folder func(A, K, V) A, initial A) (acc A)

func Fold3 added in v0.0.22

func Fold3[A, T, U, V any](seq Seq3[T, U, V], folder func(A, T, U, V) A, initial A) (acc A)
func Head[V any](seq Seq[V]) (v V, err error)

func Pull

func Pull[V any](seq Seq[V]) (next func() (V, bool), stop func())

func Pull2

func Pull2[K, V any](seq Seq2[K, V]) (next func() (K, V, bool), stop func())

Types

type Seq

type Seq[V any] iter.Seq[V]

Seq is an iterator over sequences of individual values. When called as seq(yield), seq calls yield(v) for each value v in the sequence, stopping early if yield returns false. See the iter package documentation for more details. Will be replaced with a type alias when "generic type aliases" is a stable feature

func Append added in v0.0.22

func Append[V any](seq Seq[V], v V) Seq[V]

func Bind added in v0.0.22

func Bind[V, X any](seq Seq[V], fn func(V) Seq[X]) Seq[X]

func DropFirst2 added in v0.0.22

func DropFirst2[T, U any](seq Seq2[T, U]) Seq[U]

func DropLast2 added in v0.0.22

func DropLast2[T, U any](seq Seq2[T, U]) Seq[T]

func Empty

func Empty[V any]() Seq[V]

func Filter added in v0.0.22

func Filter[V any](seq Seq[V], predicate func(V) bool) Seq[V]

func Flat added in v0.0.22

func Flat[T Seq[V], V any](seq Seq[T]) Seq[V]

func FlatMap added in v0.0.22

func FlatMap[T Seq[V], V, X any](seq Seq[T], fn func(V) X) Seq[X]

func KeepFirst3 added in v0.0.22

func KeepFirst3[T, U, V any](seq Seq3[T, U, V]) Seq[T]

func KeepLast3 added in v0.0.22

func KeepLast3[T, U, V any](seq Seq3[T, U, V]) Seq[V]

func KeepMid3 added in v0.0.22

func KeepMid3[T, U, V any](seq Seq3[T, U, V]) Seq[U]

func Map added in v0.0.22

func Map[V, X any](seq Seq[V], fn func(V) X) Seq[X]

func Remove added in v0.0.22

func Remove[V comparable](seq Seq[V], r V) Seq[V]

func Singleton

func Singleton[V any](v V) Seq[V]

func Skip added in v0.0.22

func Skip[V any](seq Seq[V], n int) Seq[V]

func Take added in v0.0.22

func Take[V any](seq Seq[V], n int) Seq[V]

func U

func U[V any](seq iter.Seq[V]) Seq[V]

func Values added in v0.0.22

func Values[V any](values ...V) Seq[V]

type Seq2

type Seq2[K, V any] iter.Seq2[K, V]

func DropFirst3 added in v0.0.22

func DropFirst3[T, U, V any](seq Seq3[T, U, V]) Seq2[U, V]

func DropLast3 added in v0.0.22

func DropLast3[T, U, V any](seq Seq3[T, U, V]) Seq2[T, U]

func DropMid3 added in v0.0.22

func DropMid3[T, U, V any](seq Seq3[T, U, V]) Seq2[T, V]

func Empty2

func Empty2[K, V any]() Seq2[K, V]

func FailFast3 added in v0.0.22

func FailFast3[T, U any](seq Seq3[T, U, error]) (res Seq2[T, U], err error)

func Filter2 added in v0.0.22

func Filter2[K, V any](seq Seq2[K, V], predicate func(K, V) bool) Seq2[K, V]

func Map2 added in v0.0.22

func Map2[K, V, X, Y any](seq Seq2[K, V], fn func(K, V) (X, Y)) Seq2[X, Y]

func Singleton2

func Singleton2[K, V any](k K, v V) Seq2[K, V]

func U2

func U2[K, V any](seq iter.Seq2[K, V]) Seq2[K, V]

type Seq3

type Seq3[T, U, V any] func(yield func(T, U, V) bool)

func Empty3 added in v0.0.22

func Empty3[T, U, V any]() Seq3[T, U, V]

func Filter3 added in v0.0.22

func Filter3[T, U, V any](seq Seq3[T, U, V], predicate func(T, U, V) bool) Seq3[T, U, V]

func Map3 added in v0.0.22

func Map3[T, U, V, X, Y, Z any](seq Seq3[T, U, V], fn func(T, U, V) (X, Y, Z)) Seq3[X, Y, Z]

func Singleton3

func Singleton3[T, U, V any](t T, u U, v V) Seq3[T, U, V]

Jump to

Keyboard shortcuts

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