slices

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[T any](s []T, f func(T) bool) []T

Filter filters values from a slice using a filter function. It returns a new slice with only the elements of s for which f returned true.

func Map

func Map[T1, T2 any](s []T1, f func(T1) T2) []T2

Map turns a []T1 to a []T2 using a mapping function. This function has two type parameters, T1 and T2. This works with slices of any type.

func Reduce

func Reduce[T1, T2 any](s []T1, initializer T2, f func(T2, T1) T2) T2

Reduce reduces a []T1 to a single value using a reduction function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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