Documentation ¶
Index ¶
- func GeneratorFactory[T any](fn func(int) T) func(ln int) Generator[T]
- func NewIter[T any](l List[T]) liter.Wrapper[T]
- func Reduce[T any](l List[T], r Reducer[T]) (t T)
- type Generator
- type Iter
- type List
- type ListSetter
- func Chain[From, To any](next *Setter[*To], l List[From], fn func(From, *To)) (out *ListSetter[From, *To])
- func InitSetter[From, To any](l List[From], fn func(From, *To)) *ListSetter[From, *To]
- func NewListSetter[From, To any](l List[From], fn func(From, To) To) *ListSetter[From, To]
- func NewSetter[From, To any](l List[From], fn func(From, To)) *ListSetter[From, To]
- type Reducer
- type Reverse
- type Setter
- type SliceList
- type Slicer
- type Transformer
- type Wrapper
- func Combinator[T any](setter Setter[T], factory ints.CombinatorFactory[int]) Wrapper[T]
- func NewGenerator[T any](ln int, fn func(int) T) Wrapper[T]
- func NewReverse[T any](l List[T]) Wrapper[T]
- func NewTransformer[In, Out any](l List[In], fn func(In) Out) Wrapper[Out]
- func Slice[T any](s []T) Wrapper[T]
- func SliceCombinator[T any](factory ints.CombinatorFactory[int], ls ...List[T]) Wrapper[[]T]
- func TransformSlice[In, Out any](s []In, fn func(In) Out) Wrapper[Out]
- func Wrap[T any](l List[T]) Wrapper[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Generator ¶
Generator fulfills List using a function to generate values by index.
type Iter ¶
Iter fulfills liter.Iter by iterating over the list.
func (*Iter[T]) Cur ¶
Cur fulfills liter.Iter returning both the current value and if iteration is done. If iteration is done, T will be the default value.
func (*Iter[T]) Next ¶
Next fulfills liter.Iter and increments the index. It returns the current index and a bool indicating if it's done.
type ListSetter ¶
func Chain ¶
func Chain[From, To any](next *Setter[*To], l List[From], fn func(From, *To)) (out *ListSetter[From, *To])
func InitSetter ¶
func InitSetter[From, To any](l List[From], fn func(From, *To)) *ListSetter[From, *To]
func NewListSetter ¶
func NewListSetter[From, To any](l List[From], fn func(From, To) To) *ListSetter[From, To]
func NewSetter ¶
func NewSetter[From, To any](l List[From], fn func(From, To)) *ListSetter[From, To]
type Reverse ¶
Reverse a List
type SliceList ¶
type SliceList[T any] []T
SliceList wraps a slice to fulfill List.
type Slicer ¶
type Slicer[T any] interface { Slice(buf []T) []T }
Slicer allows Lists to provide efficient methods for generating slices. If a List fulfills Slicer the ToSlice function will use that to generate a slice instead of iterating over the List.
type Transformer ¶
Transformer applies a function to a list to transform it's values.
func (Transformer[In, Out]) AtIdx ¶
func (t Transformer[In, Out]) AtIdx(idx int) Out
AtIdx fulfills List by passing the value at idx in the underlying list into Fn.
func (Transformer[In, Out]) Wrap ¶
func (t Transformer[In, Out]) Wrap() Wrapper[Out]
Wrap the Transformer to add Wrapper methods.
type Wrapper ¶
Wrapper provides a number of useful methods that can be applied to any List.
func Combinator ¶
func NewReverse ¶
func NewTransformer ¶
func SliceCombinator ¶
func TransformSlice ¶
TransformSlice creates a Transformer from a slice. It casts the slice to slice.Slice to fulfill the List interface.
func (Wrapper[T]) AssertEqual ¶
func (Wrapper[T]) IterFactory ¶
IterFactory creates an liter.Factory that generates a *list.Iter backed by list L.