enumerate

package
v0.0.0-...-c6c3bcc Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Consume

func Consume[T any](e Enumerable[T], n int)

Consume reads n values from an enumerable.

func Count

func Count[T any](e Enumerable[T]) int

Count reads all values from an enumerable and returns the number of values.

func Drain

func Drain[T any](e Enumerable[T])

Drain reads all values from an enumerable.

func Filter

func Filter[T any](e Enumerable[T], f func(T) bool) Enumerable[T]

Filter lets only the elements pass that f returns true for.

func Histogram

func Histogram[T comparable, C Number](e Enumerable[T]) map[T]C

Histogram reads all values from an enumerable and returns a map of values and their respective counts.

func Map

func Map[T, S any](e Enumerable[T], f func(T) S) Enumerable[S]

Map applies a function f to every element of the enumerable e.

func Max

func Max[T constraints.Ordered](e Enumerable[T]) Optional[T]

Max reads all values from an enumerable and returns the biggest one.

func Min

func Min[T constraints.Ordered](e Enumerable[T]) Optional[T]

Min reads all values from an enumerable and returns the smallest one.

func Sum

func Sum[T Number](e Enumerable[T]) (sum T)

Sum reads all values from an enumerable and sums them up.

func Synchronize

func Synchronize[T any](e Enumerable[T]) Enumerable[T]

Synchronize makes reading the enumerable thread safe.

func Unique

func Unique[T comparable](e Enumerable[T]) set.Set[T]

Unique reads all values from an enumerable and returns a set of unique values.

func Zip

func Zip[T, S any](a Enumerable[T], b Enumerable[S]) Enumerable[tuple.T2[T, S]]

Zip takes two enumerables and returns a enumerable with tuples of them.

Types

This section is empty.

Jump to

Keyboard shortcuts

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