Documentation ¶
Overview ¶
functional implements functional programming utilities.
Index ¶
- func All[T any](ts []T, f func(t T) bool) bool
- func Any[T any](ts []T, f func(t T) bool) bool
- func Count[T comparable](ts []T, k T) int
- func Count2D[T comparable](tss [][]T, k T) int
- func Count2DFunc[T any](tss [][]T, f func(T) bool) int
- func CountFunc[T any](ts []T, f func(T) bool) int
- func Filter[T any](ts []T, f func(t T) bool) []T
- func Flat[T comparable](tts [][]T) []T
- func If[T any](v bool, t, f T) T
- func Map[I, O any](items []I, f func(I) O) []O
- func MapWithIndex[I, O any](items []I, f func(int, I) O) []O
- func None[T any](ts []T, f func(t T) bool) bool
- func Reduce[B, T any](base B, items []T, f func(B, T) B) B
- func SortFunc[T any](items []T, lessFunc func(T, T) bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Count ¶
func Count[T comparable](ts []T, k T) int
func Count2D ¶
func Count2D[T comparable](tss [][]T, k T) int
func Count2DFunc ¶
func Flat ¶
func Flat[T comparable](tts [][]T) []T
func Map ¶
func Map[I, O any](items []I, f func(I) O) []O
Map maps all of the elements in `items` with the function f.
func MapWithIndex ¶
MapWithIndex maps all of the elements in `items` with function f.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.