bitter

package module
v0.0.0-...-e3c4bd2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package bitter lets you build cool rangefuncs using iter.Seq and iter.Seq2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enhance

func Enhance[V, Kp, Vp any](in iter.Seq[V], do func(V) (Kp, Vp)) iter.Seq2[Kp, Vp]

Enhance executes "do" for each entry of "in", expecting "do" to return two values.

func ForEach

func ForEach[V, Vp any](in iter.Seq[V], do func(V) Vp) iter.Seq[Vp]

ForEach executes "do" for each entry of "in".

func ForEach2

func ForEach2[K, V, Kp, Vp any](in iter.Seq2[K, V], do func(K, V) (Kp, Vp)) iter.Seq2[Kp, Vp]

ForEach2 executes "do" for each entry of "in".

func ForEachContext

func ForEachContext[V, Vp any](
	ctx context.Context,
	in iter.Seq[V],
	do func(context.Context, V) Vp,
) iter.Seq[Vp]

ForEachContext is like ForEach, but also passes in a context as the first argument.

func ForEachContext2

func ForEachContext2[K, V, Kp, Vp any](
	ctx context.Context,
	in iter.Seq2[K, V],
	do func(context.Context, K, V) (Kp, Vp),
) iter.Seq2[Kp, Vp]

ForEachContext executes "do" for each entry of "in", passing in a context as the first argument.

func FromSlice

func FromSlice[V any](s []any) iter.Seq[int]

func FromSlice2

func FromSlice2[V any](s []V) iter.Seq2[int, V]

func JustK

func JustK[K, V any](in iter.Seq2[K, V]) iter.Seq[K]

JustK turns a Seq2[K,V] and emits a Seq[K]

func JustV

func JustV[K, V any](in iter.Seq2[K, V]) iter.Seq[V]

JustK turns a Seq2[K,V] and emits a Seq[V]

func ToSlice

func ToSlice[V any](i iter.Seq[V]) []V

Types

This section is empty.

Jump to

Keyboard shortcuts

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