sliceutil

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: LGPL-2.1 Imports: 0 Imported by: 0

Documentation

Overview

Package sliceutil provides a collection of slice utility functions, including descriptive statistics functions for numerical slices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[S ~[]E, E any](s S, f func(int, E) bool) S

Filter returns a new slice containing only the elements in the input slice s for which the specified function f is true.

func Map

func Map[S ~[]E, E any, U any](s S, f func(int, E) U) []U

Map returns a new slice that contains each of the elements of the input slice s mutated by the specified function.

func Reduce

func Reduce[S ~[]E, E any, U any](s S, init U, f func(int, E, U) U) U

Reduce applies the reducing function f to each element of the input slice s, and returns the value of the last call to f. The first parameter of the reducing function f is initialized with init.

Types

This section is empty.

Jump to

Keyboard shortcuts

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