slice

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All[A any, B any](in []A, f func(A))

func Filter

func Filter[V any](slice []V, filters ...func(el V) bool) []V

func FromMapKeys

func FromMapKeys[K comparable, V any](mm map[K]V) []K

func FromMapValues

func FromMapValues[K comparable, V any](mm map[K]V) []V

func IterMapN added in v0.4.0

func IterMapN[K comparable, V any](num int, fn func(index int) (K, V)) (res map[K]V)

func IterN added in v0.4.0

func IterN[T any](num int, fn func(index int) T) (res []T)

func MakeMapKeys

func MakeMapKeys[K comparable, V any](slice []V, getKey func(V) K) map[K]V

MakeMapKeys makes a map of provided slice and a function which returns a key value for a map given an item from a slice. If key already exists, it overrides it.

func Map

func Map[A any, B any](in []A, f func(A) B) []B

func MapErr

func MapErr[A any, B any](in []A, f func(A) (B, error)) ([]B, error)

func Reduce

func Reduce[R any, V any](slice []V, reducer func(prev R, val V) (next R)) R

func ReverseInplace added in v0.3.2

func ReverseInplace[V any](slice []V)

Types

This section is empty.

Jump to

Keyboard shortcuts

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