funcy

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 1 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add added in v0.4.0

func Add[T Number](a, b T) T

func All added in v0.6.0

func All(inputs []bool) bool

func AllBut

func AllBut[T any](n int, values []T) []T

func Any added in v0.6.0

func Any(inputs []bool) bool

func As

func As[T any](v any) T

func Complement

func Complement[T any](predicate func(t T) bool) func(t T) bool

func Drain

func Drain[T any](channel <-chan T) (slice []T)

func Drop

func Drop[T any](n int, values []T) []T

func DropWhile

func DropWhile[T any](predicate func(T) bool, values []T) (result []T)

func Filter

func Filter[T any](predicate func(t T) bool, values []T) (result []T)

func FilterAs

func FilterAs[T any](collection []any) []T

func First added in v0.4.0

func First[T any](values []T) T

func Flatten added in v0.3.0

func Flatten[T any](matrix [][]T) (result []T)

func Frequencies added in v0.3.0

func Frequencies[T comparable](values []T) map[T]int

func GroupBy added in v0.5.0

func GroupBy[K comparable, V any](key func(V) K, list []V) (result [][]V)

func IndexBy

func IndexBy[K comparable, V any](key func(V) K, list []V) map[K]V

func Is

func Is[T any](v any) bool

func Last added in v0.4.0

func Last[T any](values []T) T

func Load

func Load[T any](result chan<- T, stream []T)

func Map

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

func MapCat

func MapCat[I, O any](transform func(i I) []O, values []I) (result []O)

func Multiply added in v0.4.0

func Multiply[T Number](a, b T) T

func None added in v0.6.0

func None(inputs []bool) bool

func Product added in v0.4.0

func Product[T Number](rolls []T) T

func Range

func Range[N Number](start, stop N) (result []N)

func Reduce

func Reduce[T any](calc func(a, b T) T, start T, values []T) (result T)

func Remove

func Remove[T any](predicate func(t T) bool, values []T) []T

func Repeat added in v0.4.0

func Repeat[T any](n int, t T) (result []T)

func Rest

func Rest[T any](values []T) []T

func SlicedIndexBy

func SlicedIndexBy[K comparable, V any](key func(V) K, list []V) map[K][]V

func SortAscending

func SortAscending[C LessThan, V any](key func(V) C, original []V) (result []V)

func SortDescending

func SortDescending[C LessThan, V any](key func(V) C, original []V) (result []V)

func Sum added in v0.4.0

func Sum[T Number](rolls []T) T

func Take

func Take[T any](n int, values []T) []T

func TakeWhile

func TakeWhile[T any](predicate func(T) bool, values []T) (result []T)

Types

type Integer

type Integer interface {
	int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64
}

type LessThan

type LessThan interface {
	Number | string
}

type Number

type Number interface {
	Integer | uintptr | float64 | float32
}

type Pair

type Pair[A, B any] struct {
	A A
	B B
}

func Zip

func Zip[A, B any](a []A, b []B) (result []Pair[A, B])

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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