funcy

package module
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllBut

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

func As

func As[Type any](v any) Type

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[Type any](collection []any) []Type

func IndexBy

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

func Is

func Is[Type any](v any) bool

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 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 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 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