function

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 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](vs []T, f func(T) bool) []T

Filter returns the results of the elements of this slice that match the given predicate

func ForEach

func ForEach[T any](vs []T, f func(T))

ForEach performs an action for each element of this slice

func GroupBy

func GroupBy[K comparable, V any](vs []V, f func(V) K) map[K][]V

GroupBy grouping elements according to a classification function, and returning the results in a Map

func Limit

func Limit[T any](vs []T, limit int) []T

Limit returns the results of the elements of this slice, truncated to be no longer than maxSize in length

func Map

func Map[T any, R any](vs []T, f func(T) R) []R

Map returns the results of applying the given function to the elements of this slice

func Min

func Min[T any](vs []T, less func(T, T) bool) T

Min returns the minimum element of this stream according to the provided less function

func Reduce

func Reduce[T any, R any](vs []T, f func(T, R, int) R, initial R) R

Reduce performs a reduction on the elements of this slice, using the provided identity, accumulation and combining functions

Types

This section is empty.

Jump to

Keyboard shortcuts

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