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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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