fp

package module
v0.0.0-...-c83ee6d Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2022 License: MIT Imports: 1 Imported by: 0

README

fp

Collection of functional programming constructs for Go

License MIT Go version GoDoc Go Report Card

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllSlice

func AllSlice[C any](a []C, pred func(C) bool) bool

AllSlice returns a boolean representing whether the predicate returns true for all members of the collection.

func AnySlice

func AnySlice[C any](a []C, pred func(C) bool) bool

AnySlice returns true if any member of the collection satisfies the predicate

func FilterSlice

func FilterSlice[C any](in []C, pred func(C) bool) []C

FilterSlice creates a new slice of all elements for which the predicate returns false.

func FoldSlice

func FoldSlice[C any](s []C, reduction func(C, C) C) C

FoldSlice returns the result of applying the rediction function to each member of collection sequentially.

func MapSlice

func MapSlice[C any](a []C, procedure func(C) C) []C

MapSlice returns a collection the same size as the input collection, where each output is the result of applying procedure to the input element.

func PartitionSlice

func PartitionSlice[C any](col []C, pred func(C) bool) ([]C, []C)

PartitionSlice returns two arrays, the first containing elements which satify the predicate, the second containing elements which do not.

func QuickSortSlice

func QuickSortSlice[C constraints.Ordered](in []C) []C

Implements the Quicksort algorythm on a collection of Ordered elements

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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