iter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: MIT Imports: 5 Imported by: 77

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForEach

func ForEach[T any](input []T, f func(*T))

ForEach executes f in parallel over each element in input.

It is safe to mutate the input parameter, which makes it possible to map in place.

ForEach always uses at most runtime.GOMAXPROCS goroutines. It takes roughly 2µs to start up the goroutines and adds an overhead of roughly 50ns per element of input.

func ForEachIdx

func ForEachIdx[T any](input []T, f func(int, *T))

ForEachIdx is the same as ForEach except it also provides the index of the element to the callback.

func Map

func Map[T, R any](input []T, f func(*T) R) []R

Map applies f to each element of input, returning the mapped result.

func MapErr

func MapErr[T any, R any](input []T, f func(*T) (R, error)) ([]R, error)

MapErr applies f to each element of the input, returning the mapped result and a combined error of all returned errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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