functional

package
v6.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyOrFail

func ApplyOrFail[T any](xs []T, f func(T) error) error

ApplyOrFail tries applying the provided function for each element of the slice If the function returns an error, we break execution and return the error

func Fold

func Fold[T any, Acc any](xs []T, f func(Acc, T) Acc, acc Acc) Acc

Fold accumulates the result of f into acc and returns acc by applying f over each element in the slice

func Map

func Map[T comparable, K any](s []T, f func(T) K) []K

Map applies a function to each element of a slice and returns the modified slice without considering the index of each element.

func MapIdx

func MapIdx[V comparable, R any](s []V, f func(int, V) R) []R

MapIdx applies a function to each element and index of a slice, returning the modified slice with consideration of the index.

Types

This section is empty.

Jump to

Keyboard shortcuts

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