iter

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[T any](s iter.Seq[T], p func(v T) bool) iter.Seq[T]

Filter returns a sequence of elements from s that satisfy predicate p.

func Filter2

func Filter2[K any, V any](s iter.Seq2[K, V], p func(k K, v V) bool) iter.Seq2[K, V]

Filter2 returns a key-value sequence of pairs from s that satisfy predicate p.

func Find

func Find[T any](s iter.Seq[T], f func(v T) bool) (T, bool)

Find returns the first element in s satisfying predicate f and true. If no element matches, it returns the zero value of T and false.

func Find2

func Find2[K any, V any](s iter.Seq2[K, V], f func(k K, v V) bool) (K, V, bool)

Find2 returns the first key-value pair in s satisfying predicate f and true. If no pair matches, it returns zero values of K and V, and false.

func Map

func Map[T any, U any](src iter.Seq[T], f func(T) U) iter.Seq[U]

Map returns a sequence produced by applying f to each element of src.

func Map2

func Map2[K1, V1, K2, V2 any](src iter.Seq2[K1, V1], f func(K1, V1) (K2, V2)) iter.Seq2[K2, V2]

Map2 transforms a key-value sequence src by applying f to each pair.

func Map2To1

func Map2To1[K, V, T any](src iter.Seq2[K, V], f func(K, V) T) iter.Seq[T]

Map2To1 returns a single-value sequence by applying f to each key-value pair from src.

func MapTo2

func MapTo2[T, K, V any](src iter.Seq[T], f func(T) (K, V)) iter.Seq2[K, V]

MapTo2 returns a key-value sequence by applying f to each element of src.

Types

This section is empty.

Jump to

Keyboard shortcuts

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