slice

package
v0.0.0-...-0e61b49 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FoldLeft

func FoldLeft[A, B any](xs Slice[A], folder func(B, A, int) B, seed B) B

func NewSliceFunctor

func NewSliceFunctor[A, B any]() *sliceFunctor[A, B]

func NewSlicePure

func NewSlicePure[A any]() *slicePure[A]

Types

type Contain

type Contain[A any] struct {
	interfaces.Eq[A, A]
}

func (*Contain[A]) Has

func (self *Contain[A]) Has(xs Slice[A], x A) bool

type Distinct

type Distinct[A comparable] struct{}

func (*Distinct[A]) Distinct

func (self *Distinct[A]) Distinct(xs Slice[A]) Slice[A]

type Grouping

type Grouping[A, B any] struct {
	interfaces.Eq[B, B]
	interfaces.Hash[B]
}

func (Grouping[A, B]) GroupBy

func (g Grouping[A, B]) GroupBy(xs Slice[A], f func(A) B) generic.HashMap[B, Slice[A]]

type SequenceSlice

type SequenceSlice[F_, A any] struct {
	*TraverseSlice[F_, types.HKT[F_, A], A]
}

func (*SequenceSlice[F_, A]) Sequence

func (self *SequenceSlice[F_, A]) Sequence(
	xs Slice[types.HKT[F_, A]],
) types.HKT[F_, Slice[A]]

type Slice

type Slice[A any] []A

Slice

func Concat

func Concat[A any](xs, ys Slice[A]) Slice[A]

func Cons

func Cons[A any](x A, xs Slice[A]) Slice[A]

func Container

func Container[A any](capacity int) Slice[A]

func Empty

func Empty[A any]() Slice[A]

func FlatMap

func FlatMap[A, B any](xs Slice[A], f func(A) Slice[B]) Slice[B]

func Flatten

func Flatten[A any](xxs Slice[Slice[A]]) Slice[A]

func From

func From[A any](xs []A) Slice[A]

func Make

func Make[A any](xs ...A) Slice[A]

func Map

func Map[A, B any](xs Slice[A], f func(A) B) Slice[B]

func Room

func Room[A any](length int) Slice[A]

func ZipBy

func ZipBy[A, B, C any](xs Slice[A], ys Slice[B], zip func(A, B) C) Slice[C]

func (Slice[A]) Append

func (xs Slice[A]) Append(x ...A) Slice[A]

func (Slice[A]) ElemType

func (s Slice[A]) ElemType(A)

func (Slice[A]) Filter

func (xs Slice[A]) Filter(f func(A) bool) Slice[A]

func (Slice[A]) For

func (xs Slice[A]) For(f func(A))

func (Slice[A]) ForEach

func (ys Slice[A]) ForEach(f func(int, A))

func (Slice[A]) Get

func (ys Slice[A]) Get(index int) maybe.Maybe[A]

func (Slice[A]) Head

func (xs Slice[A]) Head() maybe.Maybe[A]

func (Slice[A]) Init

func (xs Slice[A]) Init() maybe.Maybe[Slice[A]]

func (Slice[A]) Insert

func (ys Slice[A]) Insert(index int, x A) maybe.Maybe[Slice[A]]

func (Slice[A]) Iter

func (s Slice[A]) Iter() collection.Iterator[A]

func (Slice[A]) Kind

func (s Slice[A]) Kind(SliceKind)

func (Slice[A]) Last

func (xs Slice[A]) Last() maybe.Maybe[A]

func (Slice[A]) Len

func (xs Slice[A]) Len() int

func (Slice[A]) Set

func (ys Slice[A]) Set(index int, x A) Slice[A]

func (Slice[A]) Slice

func (xs Slice[A]) Slice(start, end int) Slice[A]

func (Slice[A]) Tail

func (xs Slice[A]) Tail() maybe.Maybe[Slice[A]]

type SliceCollector

type SliceCollector[A any] struct {
	collection.FromIterator[SliceKind, A]
}

func NewSliceCollector

func NewSliceCollector[A any]() *SliceCollector[A]

func (*SliceCollector[A]) Collect

func (co *SliceCollector[A]) Collect(iter collection.Iterator[A]) types.HKT[SliceKind, A]

type SliceFromIter

type SliceFromIter[A any] struct{}

func (*SliceFromIter[A]) FromIter

func (self *SliceFromIter[A]) FromIter(iter collection.Iterator[A]) types.HKT[SliceKind, A]

type SliceKind

type SliceKind types.Kind

type TraverseOption

type TraverseOption[A, B any] struct{}

func (*TraverseOption[A, B]) Traverse

func (self *TraverseOption[A, B]) Traverse(
	xs Slice[A],
	f func(A) maybe.Maybe[B],
) maybe.Maybe[Slice[B]]

type TraverseResult

type TraverseResult[A, B any] struct{}

func (*TraverseResult[A, B]) Traverse

func (self *TraverseResult[A, B]) Traverse(
	xs Slice[A], f func(A) result.Result[B],
) result.Result[Slice[B]]

type TraverseSlice

type TraverseSlice[F_, A, B any] struct {
	interfaces.Pure[F_, Slice[B]]
	interfaces.Apply[F_, Slice[B], B]
	functor.Functor[F_, tuple.Tuple2[Slice[B], B], Slice[B]]
}

func (*TraverseSlice[F_, A, B]) Traverse

func (self *TraverseSlice[F_, A, B]) Traverse(
	xs Slice[A],
	f func(A) types.HKT[F_, B],
) types.HKT[F_, Slice[B]]

Jump to

Keyboard shortcuts

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