Help us shape the future of Go! Take the 2026 Go Developer Survey

generic

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ap added in v1.0.4

func Ap[BS ~[]B, ABS ~[]func(A) B, AS ~[]A, B, A any](fa AS) func(ABS) BS

func Append

func Append[GA ~[]A, A any](as GA, a A) GA

func Chain added in v1.0.4

func Chain[AS ~[]A, BS ~[]B, A, B any](f func(A) BS) func(AS) BS

func Empty

func Empty[GA ~[]A, A any]() GA

func FilterMap

func FilterMap[GA ~[]A, GB ~[]B, A, B any](f func(a A) O.Option[B]) func(GA) GB

func First

func First[GA ~[]A, A any](as GA) O.Option[A]

func From

func From[GA ~[]A, A any](data ...A) GA

From constructs an array from a set of variadic arguments

func Head[GA ~[]A, A any](as GA) O.Option[A]

func IsEmpty added in v1.0.6

func IsEmpty[AS ~[]A, A any](as AS) bool

func Last

func Last[GA ~[]A, A any](as GA) O.Option[A]

func Lookup

func Lookup[GA ~[]A, A any](idx int) func(GA) O.Option[A]

func MakeBy added in v1.0.4

func MakeBy[AS ~[]A, F ~func(int) A, A any](n int, f F) AS

MakeBy returns a `Array` of length `n` with element `i` initialized with `f(i)`.

func Match added in v1.0.6

func Match[AS ~[]A, A, B any](onEmpty func() B, onNonEmpty func(AS) B) func(AS) B

func MatchLeft added in v1.0.6

func MatchLeft[AS ~[]A, A, B any](onEmpty func() B, onNonEmpty func(A, AS) B) func(AS) B

func MonadAp added in v1.0.4

func MonadAp[BS ~[]B, ABS ~[]func(A) B, AS ~[]A, B, A any](fab ABS, fa AS) BS

func MonadChain added in v1.0.4

func MonadChain[AS ~[]A, BS ~[]B, A, B any](fa AS, f func(a A) BS) BS

func MonadFilterMap

func MonadFilterMap[GA ~[]A, GB ~[]B, A, B any](fa GA, f func(a A) O.Option[B]) GB

func MonadMap

func MonadMap[GA ~[]A, GB ~[]B, A, B any](as GA, f func(a A) B) GB

func MonadPartition

func MonadPartition[GA ~[]A, A any](as GA, pred func(A) bool) tuple.Tuple2[GA, GA]

func Of

func Of[GA ~[]A, A any](value A) GA

Of constructs a single element array

func Partition

func Partition[GA ~[]A, A any](pred func(A) bool) func(GA) tuple.Tuple2[GA, GA]

func Replicate added in v1.0.4

func Replicate[AS ~[]A, A any](n int, a A) AS

func Size

func Size[GA ~[]A, A any](as GA) int

func Sort

func Sort[GA ~[]T, T any](ord O.Ord[T]) func(ma GA) GA

Sort implements a stable sort on the array given the provided ordering

func Tail

func Tail[GA ~[]A, A any](as GA) O.Option[GA]

func UpsertAt

func UpsertAt[GA ~[]A, A any](a A) func(GA) GA

Types

This section is empty.

Jump to

Keyboard shortcuts

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