fx

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: MIT Imports: 0 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[E any](elements []E, test func(e E) bool) []E

Filter returns a subset of elements for each test which is true

func Identity

func Identity[V any](input V) V

Identity is an f(x) = x function. Really useful for testing.

func Map

func Map[I any, O any](inputs []I, transform func(i I) O) []O

Map transforms a slice of inputs through the transform function to result in an equal sized slice of outputs.

func Split

func Split[E any](elements []E, test func(e E) bool) ([]E, []E)

Split applies all elements e to test. All e which test returns true are in the first slice, all others are in the second slice. Useful for splitting a slice into two buckets to be further operated on. Filter discards the negative results of test which is more efficient if no further processing needs to occur.

Types

This section is empty.

Jump to

Keyboard shortcuts

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