slicer

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All[T comparable](x T, vs ...T) bool

func AllFn

func AllFn[T comparable](fn func(T) bool, vs ...T) bool

func AllFnErr

func AllFnErr[T comparable](fn func(T) (bool, error), vs ...T) trier.Try[bool]

func AllFnErrI

func AllFnErrI[T comparable](fn func(int, T) (bool, error), vs ...T) trier.Try[bool]

func AllFnI

func AllFnI[T comparable](fn func(int, T) bool, vs ...T) bool

func Append

func Append[T any](slice optioner.Option[[]T], elems optioner.Option[[]T]) optioner.Option[[]T]

func AppendLift

func AppendLift[T any](slice optioner.Option[[]T], items ...T) optioner.Option[[]T]

func AppendOption

func AppendOption[T any](slice optioner.Option[[]T], items ...optioner.Option[T]) optioner.Option[[]T]

func Chunk

func Chunk[T comparable](size int, item ...T) [][]T

func Contains

func Contains[T comparable](v T, items ...T) bool

func ContainsFn

func ContainsFn[T comparable](fn func(T) bool, items ...T) bool

func ContainsFnErr

func ContainsFnErr[T comparable](fn func(T) (bool, error), items ...T) trier.Try[bool]

func ContainsFnErrI

func ContainsFnErrI[T comparable](fn func(int, T) (bool, error), items ...T) trier.Try[bool]

func ContainsFnI

func ContainsFnI[T comparable](fn func(int, T) bool, items ...T) bool

func Dedup

func Dedup[T comparable](items ...T) []T

func DedupFn

func DedupFn[T any, K comparable](fn func(T) K, items ...T) []T

func DedupFnErr

func DedupFnErr[T any, K comparable](fn func(T) (K, error), items ...T) trier.Try[[]T]

func Diff

func Diff[T comparable](as, bs []T) []T

func DiffFn

func DiffFn[T any](as, bs []T, fn func(T, T) bool) []T

func DiffFnErr

func DiffFnErr[T any](as, bs []T, fn func(T, T) (bool, error)) trier.Try[[]T]

func Each

func Each[T any](fn func(T), items ...T)

func EachErr

func EachErr[T any](fn func(T) error, items ...T) error

func Equals

func Equals[T comparable](as, bs []T) bool

func EqualsFn

func EqualsFn[T comparable](as, bs []T, fn func(T, T) bool) bool

func EqualsFnErr

func EqualsFnErr[T comparable](as, bs []T, fn func(T, T) (bool, error)) trier.Try[bool]

func Exist

func Exist[T comparable](s T, items ...T) bool

func ExistFn

func ExistFn[T any](fn func(T) bool, items ...T) bool

func ExistFnErr

func ExistFnErr[T any](fn func(T) (bool, error), items ...T) trier.Try[bool]

func Filter

func Filter[T any](fn func(T) bool, items ...T) []T

func FilterErr

func FilterErr[T any](fn func(T) (bool, error), items ...T) trier.Try[[]T]

func Find

func Find[T comparable](match T, items ...T) (T, bool)

func FindFn

func FindFn[T any](fn func(T) bool, items ...T) (T, bool)

func FindFnErr

func FindFnErr[T any](fn func(T) (bool, error), items ...T) trier.Try[optioner.Option[T]]

func Flatten

func Flatten[T any](items ...[]T) []T

func FlattenFn

func FlattenFn[T any, U any](fn func(vs []T) []U, items ...[]T) []U

func FlattenFnErr

func FlattenFnErr[T any, U any](fn func(vs []T) ([]U, error), items ...[]T) trier.Try[[]U]

func FoldLeft

func FoldLeft[I any, O any](initial O, fn func(O, I) O, items ...I) O

func FoldLeftErr

func FoldLeftErr[I any, O any](initial O, fn func(O, I) (O, error), items ...I) trier.Try[O]

func FoldLeftErrI

func FoldLeftErrI[I any, O any](initial O, fn func(int, O, I) (O, error), items ...I) trier.Try[O]

func FoldLeftI

func FoldLeftI[I any, O any](initial O, fn func(int, O, I) O, items ...I) O

func FoldRight

func FoldRight[I any, O any](initial O, fn func(O, I) O, items ...I) O

func FoldRightErr

func FoldRightErr[I any, O any](initial O, fn func(O, I) (O, error), items ...I) trier.Try[O]

func FoldRightErrI

func FoldRightErrI[I any, O any](initial O, fn func(int, O, I) (O, error), items ...I) trier.Try[O]

func FoldRightI

func FoldRightI[I any, O any](initial O, fn func(int, O, I) O, items ...I) O
func Head[T any](items ...T) optioner.Option[T]

func Map

func Map[T any, U any](fn func(T) U, items optioner.Option[[]T]) optioner.Option[[]U]

func MapErr

func MapErr[T any, U any](fn func(T) (U, error), items optioner.Option[[]T]) trier.Try[optioner.Option[[]U]]

func MapErrI

func MapErrI[T any, U any](fn func(int, T) (U, error), items optioner.Option[[]T]) trier.Try[optioner.Option[[]U]]

func MapI

func MapI[T any, U any](fn func(int, T) U, items optioner.Option[[]T]) optioner.Option[[]U]

func ReduceTry

func ReduceTry[V any, A any](vs []V, fn func(V, A) (A, error), initial A) trier.Try[A]

func Tail

func Tail[T any](items ...T) optioner.Option[T]

Types

type Slicer

type Slicer[T any] struct {
	optioner.Option[[]T]
}

func (*Slicer[T]) Append

func (t *Slicer[T]) Append(item T)

func (Slicer[T]) Items

func (t Slicer[T]) Items() []T

func (*Slicer[T]) Len

func (t *Slicer[T]) Len() int

Jump to

Keyboard shortcuts

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