iterops

package
v0.434.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Changes

func Changes[S, C any](in iter.Seq[S], extractor ChangeExtractor[S, C]) iter.Seq[C]

Changes returns a stream of change events from a stream of evolving state.

func Concat

func Concat[T any](in ...iter.Seq[T]) iter.Seq[T]

func Const

func Const[T any](in ...T) iter.Seq[T]

func Contains

func Contains[T comparable](seq iter.Seq[T], value T) bool

Contains returns true if the sequence contains the value.

This consumes the iterator to the first occurrence of the value.

func Dedup

func Dedup[T any](seq iter.Seq[T]) iter.Seq[T]

Dedup returns an iterator that yields values from the input iterator, removing consecutive duplicates.

func Empty

func Empty[T any]() iter.Seq[T]

Empty returns an empty iterator.

func FlatMap

func FlatMap[T any, U any](in iter.Seq[T], fn func(T) iter.Seq[U]) iter.Seq[U]

func Map

func Map[T any, U any](in iter.Seq[T], fn func(T) U) iter.Seq[U]

func WindowPair

func WindowPair[T any](in iter.Seq[T]) iter.Seq[tuple.Pair[T, T]]

WindowPair returns a window of size 2 of the input iterator.

Types

type ChangeExtractor

type ChangeExtractor[S, C any] func(tuple.Pair[S, S]) iter.Seq[C]

ChangeExtractor extracts changes from an old and new state.

Jump to

Keyboard shortcuts

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