Documentation
¶
Index ¶
- func Collect[T any](iter Iter[T]) []T
- func CollectToMap[T any, T1 comparable, T2 any](iter Iter[T], fkv func(T) (T1, T2)) map[T1]T2
- func CollectToMapFK[T any, T1 comparable](iter Iter[T], fk func(T) T1) map[T1]T
- func Consume[T any](iter Iter[T])
- func Count[T any](iter Iter[T]) int
- func Equal[E comparable](iter1, iter2 Iter[E]) bool
- func Fold[T any, B any](iter Iter[T], init B, f func(B, T) B) B
- func FoldZv[T any, B any](iter Iter[T], f func(B, T) B) B
- func ForEach[T any](iter Iter[T], f func(T))
- func Last[T any](iter Iter[T]) (T, bool)
- func Seq[T any](it Iter[T]) iter.Seq[T]
- func SeqIx[T any](it Iter[T]) iter.Seq2[int, T]
- type BufIter
- type FieldsIter
- type FieldsIterFn
- type FilterIter
- type FilterMapIter
- type ISplit
- type Iter
- func Concat[T any](c ...Iter[T]) Iter[T]
- func Empty[T any]() Iter[T]
- func Fields(s string) Iter[string]
- func FieldsFn(s string, fn func(rune) bool) Iter[string]
- func FieldsSet(s string, cutset string) Iter[string]
- func Filter[T any](it Iter[T], p func(T) bool) Iter[T]
- func FilterMap[T, U any](it Iter[T], mp func(T) (U, bool)) Iter[U]
- func Fuse[T any](it Iter[T]) Iter[T]
- func Map[T any, U any](it Iter[T], mf func(T) U) Iter[U]
- func NewBufIter[T any](buf []T) Iter[T]
- func NewBufIterU[S ~[]T, T any](buf S) Iter[T]
- func NewLineIter(r io.Reader) Iter[string]
- func Once[T any](v T) Iter[T]
- func Range(end int) Iter[int]
- func Scan[T any, U any](it Iter[T], init U, scanfunc func(U, T) U) Iter[U]
- func ScanZv[T any, U any](it Iter[T], scanfunc func(U, T) U) Iter[U]
- func Skip[T any](i Iter[T], n int) Iter[T]
- func SkipUntil[T any](it Iter[T], p func(T) bool) Iter[T]
- func SkipUntilIncl[T any](it Iter[T], p func(T) bool) Iter[T]
- func SkipUntilInclAlt[T any](it Iter[T], p func(T) bool) Iter[T]
- func SkipWhile[T any](it Iter[T], p func(T) bool) Iter[T]
- func Split(s, sep string) Iter[string]
- func Split4(s, sep string) Iter[string]
- func SplitIter2(s, sep string) Iter[string]
- func SplitIter3(s, sep string) Iter[string]
- func StringSplit(s, sep string) Iter[string]
- func StringSplit4(s, sep string) Iter[string]
- func Take[T any](i Iter[T], n int) Iter[T]
- func TakeUntil[T any](it Iter[T], pred func(T) bool) Iter[T]
- func TakeUntilIncl[T any](it Iter[T], pred func(T) bool) Iter[T]
- func TakeWhile[T any](it Iter[T], p func(T) bool) Iter[T]
- func Variadic[T any](v ...T) Iter[T]
- type MapIter
- type NumIter
- type Pred
- type PredIter
- type RangeIter
- type SkipIter
- type SkipUntilIncl3
- type SkipUntilInclT
- type SkipWhileIter
- type SplitIter
- type TakeIter
- type TakeWhileIter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectToMap ¶
func CollectToMap[T any, T1 comparable, T2 any](iter Iter[T], fkv func(T) (T1, T2)) map[T1]T2
Collect elements of an iterator into a map, by function returning (key, value) naming...
func CollectToMapFK ¶
func CollectToMapFK[T any, T1 comparable](iter Iter[T], fk func(T) T1) map[T1]T
Collect elements of an iterator into a map, by function returning key naming...
func Equal ¶
func Equal[E comparable](iter1, iter2 Iter[E]) bool
compare iterators for equality. Same length and same content. Will consume from iterators not sure how useful this is
func Fold ¶
fold!! (it Iter[T], in B, acc func(B, T) B {} iter[T] is empty, retrurns Zero value for B
Types ¶
type BufIter ¶
type BufIter[T any] struct { // contains filtered or unexported fields }
buffer iterator - its not a buf its a slice!
type FieldsIter ¶
type FieldsIter struct {
// contains filtered or unexported fields
}
the type behind the Fields iterator
func (*FieldsIter) Next ¶
func (fi *FieldsIter) Next() (string, bool)
Next() implementation for Iter
type FieldsIterFn ¶
type FieldsIterFn struct {
// contains filtered or unexported fields
}
the type behind the Fields iterator
func (*FieldsIterFn) Next ¶
func (fi *FieldsIterFn) Next() (string, bool)
Next() implementation for Iter
type FilterIter ¶
type FilterIter[T any] struct { // contains filtered or unexported fields }
---------------------- Filter ---------------------------------
func (*FilterIter[T]) Next ¶
func (fit *FilterIter[T]) Next() (T, bool)
type FilterMapIter ¶
type FilterMapIter[T, U any] struct { // contains filtered or unexported fields }
---------------------- FilterMap ---------------------------------
func (*FilterMapIter[T, U]) Next ¶
func (fmit *FilterMapIter[T, U]) Next() (U, bool)
type Iter ¶
func Fields ¶
Split a string in fields (words) separated by whitespace, similar to standard strings.Fields, but returns Iter[string]
func FieldsFn ¶
Split a string in fields (words) separated by code points satisfying fn(rune), similar to standard strings.FieldsFunc, but returns Iter[string]
func FieldsSet ¶
Split a string in fields separated by runs of code points contained in string cutset. returns Iter[string]
func FilterMap ¶
filterMap is a combination of map and filter the mapping function must return two values u, and ok values where ok is true will be returned in iterator
func NewBufIter ¶
create the buffer iterator no underlying types, what difefrence does this make? (like in slices package ?)
func NewBufIterU ¶
create the buffer iterator signature similar to slices.Clone() in std is this signature necessary in order to handle underlying types ??
func ScanZv ¶
ScanZv will use the zero vaue for the accumulator type as initial, so no init value should be provided whether a zero value can be used as initial value is depending on the actual accumulation performed by scanfunc
func SkipUntilIncl ¶
Lazily skip items until predicate is true. The first item where predicate is true will also be skipped. this is similar to repeat ... until loop as known from Pascal: the body is processed even though predicate turns out to be true one element is skipped even when condition is true in first execution
func SkipUntilInclAlt ¶
TST version -----------------------------
func Split ¶
return Iter[string] for splitting string into substrings separated by a deliminator string
func SplitIter2 ¶
func SplitIter3 ¶
func StringSplit ¶
func StringSplit4 ¶
func TakeUntilIncl ¶
This will take elements from the iterator up to, and including, the first element where predicate is true. if all predicates are false. all elemenst will be taken if all predicates are true, the first element will be taken
type MapIter ¶
type MapIter[T, U any] struct { // contains filtered or unexported fields }
---------------------- MAP ---------------------------------
type NumIter ¶
type NumIter struct {
// contains filtered or unexported fields
}
func NewNumIter ¶
type PredIter ¶
type PredIter struct {
// contains filtered or unexported fields
}
predicate iterator
func NewPredIter ¶
type SkipUntilIncl3 ¶
type SkipUntilIncl3[T any] struct { // contains filtered or unexported fields }
func (*SkipUntilIncl3[T]) Next ¶
func (it *SkipUntilIncl3[T]) Next() (T, bool)
func (*SkipUntilIncl3[T]) Next2 ¶
func (suit *SkipUntilIncl3[T]) Next2() (T, bool)
func (*SkipUntilIncl3[T]) Next3 ¶
func (suit *SkipUntilIncl3[T]) Next3() (T, bool)
type SkipUntilInclT ¶
type SkipUntilInclT[T any] struct { // contains filtered or unexported fields }
func (*SkipUntilInclT[T]) Next ¶
func (suit *SkipUntilInclT[T]) Next() (T, bool)
type SkipWhileIter ¶
type SkipWhileIter[T any] struct { // contains filtered or unexported fields }
-------------
func (*SkipWhileIter[T]) Next ¶
func (swit *SkipWhileIter[T]) Next() (T, bool)
type SplitIter ¶
type SplitIter struct {
// contains filtered or unexported fields
}
type for Split iterator
type TakeWhileIter ¶
type TakeWhileIter[T any] struct { // contains filtered or unexported fields }
-------------
func (*TakeWhileIter[T]) Next ¶
func (twit *TakeWhileIter[T]) Next() (T, bool)
func (*TakeWhileIter[T]) Next2 ¶
func (twit *TakeWhileIter[T]) Next2() (T, bool)