Documentation ¶
Index ¶
- func Alternate[V any](seqs ...iter.Seq[V]) iter.Seq[V]
- func Alternate2[K, V any](seqs ...iter.Seq2[K, V]) iter.Seq2[K, V]
- func AppendSeq2[S ~[]KeyValue[K, V], K, V any](s S, seq iter.Seq2[K, V]) S
- func Chan[V any](ch <-chan V, f func()) iter.Seq[V]
- func Decorate[V any](seq iter.Seq[V], prepend, append Iterable[V]) iter.Seq[V]
- func Decorate2[K, V any](seq iter.Seq2[K, V], prepend, append Iterable2[K, V]) iter.Seq2[K, V]
- func Enumerate[T any](seq iter.Seq[T]) iter.Seq2[int, T]
- func Flatten[S ~[]E, E any](seq iter.Seq[S]) iter.Seq[E]
- func FlattenF[S1 ~[]E1, E1 any, E2 any](i iter.Seq2[S1, E2]) iter.Seq2[E1, E2]
- func FlattenL[S2 ~[]E2, E1 any, E2 any](i iter.Seq2[E1, S2]) iter.Seq2[E1, E2]
- func Heap[T any](h heap.Interface) iter.Seq[T]
- func LimitUntil[V any](seq iter.Seq[V], f func(V) bool) iter.Seq[V]
- func LimitUntil2[K, V any](seq iter.Seq2[K, V], f func(K, V) bool) iter.Seq2[K, V]
- func ListAll[T any](l *list.List) iter.Seq[T]
- func ListBackward[T any](l *list.List) iter.Seq[T]
- func Omit[K any](seq iter.Seq[K]) func(yield func() bool)
- func Omit2[K, V any](seq iter.Seq2[K, V]) func(yield func() bool)
- func OmitF[T, U any](i iter.Seq2[T, U]) iter.Seq[U]
- func OmitL[T, U any](i iter.Seq2[T, U]) iter.Seq[T]
- func Pairs[K, V any](seq1 iter.Seq[K], seq2 iter.Seq[V]) iter.Seq2[K, V]
- func Range[T Numeric](start, end T) iter.Seq[T]
- func Repeat[V any](v V, n int) iter.Seq[V]
- func Repeat2[K, V any](k K, v V, n int) iter.Seq2[K, V]
- func RepeatFunc[V any](fnV func() V, n int) iter.Seq[V]
- func RepeatFunc2[K, V any](fnK func() K, fnV func() V, n int) iter.Seq2[K, V]
- func RingAll[T any](r *ring.Ring) iter.Seq[T]
- func RingBackward[T any](r *ring.Ring) iter.Seq[T]
- func Scan(scanner *bufio.Scanner) iter.Seq2[string, error]
- func Skip[V any](seq iter.Seq[V], n int) iter.Seq[V]
- func Skip2[K, V any](seq iter.Seq2[K, V], n int) iter.Seq2[K, V]
- func SkipWhile[V any](seq iter.Seq[V], f func(V) bool) iter.Seq[V]
- func SkipWhile2[K, V any](seq iter.Seq2[K, V], f func(K, V) bool) iter.Seq2[K, V]
- func StringsChunk(s string, n int) iter.Seq[string]
- func StringsCollect(seq iter.Seq[string], sizeHint int) string
- func StringsCutNewLine(s string) (int, int)
- func StringsCutUpperCase(s string) (tokUntil int, skipUntil int)
- func StringsRuneChunk(s string, n int) iter.Seq[string]
- func StringsSplitFunc(s string, n int, splitFn StringsCutterFunc) iter.Seq[string]
- func SyncMap[K, V any](m *sync.Map) iter.Seq2[K, V]
- func Transpose[K, V any](seq iter.Seq2[K, V]) iter.Seq2[V, K]
- func Window[S ~[]E, E any](s S, n int) iter.Seq[S]
- type FuncIterable
- type FuncIterable2
- type IntoIterable
- type IntoIterable2
- type Iterable
- type Iterable2
- type KeyValue
- type KeyValues
- type Numeric
- type StringsCutterFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Alternate ¶
Alternate returns an iterator that yields alternatively each seq from head to tail. The first exhausted seq stops the iterator.
func Alternate2 ¶
Alternate returns an iterator that yields alternatively each seq from head to tail. The first exhausted seq stops the iterator.
func AppendSeq2 ¶
AppendSeq2 appends the values from seq to the KeyValue slice and returns the extended slice.
func Decorate ¶
Decorate decorates seq by prepend and append, by yielding additional elements before and after seq yields.
func Decorate2 ¶
Decorate2 decorates seq by prepend and append, by yielding additional elements before and after seq yields.
func Enumerate ¶
Enumerate wraps seq so that former part of paired values has an index starting from 0. Each time values are yielded index is increased by 1.
func FlattenF ¶
FlattenF returns an iterator over pairs of slice and non-slice. While iterating over slices, the latter part of pair is repeated.
func FlattenL ¶
FlattenL returns an iterator over pairs of non-slice and slice. While iterating over slices, the former part of pair is repeated.
func Heap ¶
Heap returns an iterator over heap.Interface. Consuming iter.Seq[T] also consumes h. To avoid this, the caller must clone input h before passing to Heap.
func LimitUntil ¶
LimitUntil returns an iterator over seq that yields until f returns false.
func LimitUntil2 ¶
LimitUntil2 returns an iterator over seq that yields until f returns false.
func ListBackward ¶
ListBackward returns an iterator over l, traversing it backward by calling Back and Prev.
func Pairs ¶
Pairs combines seq1 and seq2 into an iterator over key-value pairs. If either stops, the returned iterator stops.
func Range ¶
Range produces an iterator that yields sequential Numeric values in range [start, end). Values start from `start` and steps toward `end` 1 by 1, increased or decreased depending on start < end or not.
func Repeat ¶
Repeat returns an iterator that generates v n times. If n < 0, the returned iterator repeats forever.
func Repeat2 ¶
Repeat2 returns an iterator that generates v n times. If n < 0, the returned iterator repeats forever.
func RepeatFunc ¶ added in v0.0.3
RepeatFunc returns an iterator that generates result from fnV n times. If n < 0, the returned iterator repeats forever.
func RepeatFunc2 ¶ added in v0.0.3
RepeatFunc2 returns an iterator that generates result of fnK and fnV n times. If n < 0, the returned iterator repeats forever.
func RingAll ¶
Ring returns an iterator over r. by traversing from r and consecutively calling Next.
func RingBackward ¶
RingBackward returns an iterator over r, traversing it backward starting from r and consecutively calling Prev.
func SkipWhile2 ¶
SkipWhile2 returns an iterator over seq that skips key-value pairs until f returns false.
func StringsChunk ¶
StringsChunk returns an iterator over non overlapping sub strings of n bytes. Sub slicing may cut in mid of utf8 sequences.
func StringsCollect ¶
StringsCollect reduces seq to a single string. sizeHint hints size of internal buffer. Correctly sized sizeHint may reduce allocation.
func StringsCutNewLine ¶
StringsCutNewLine is used with StringsSplitFunc. The input strings will be splitted at "\n". It also skips "\r" following "\n".
func StringsCutUpperCase ¶
StringsCutUpperCase splits "UpperCasedWords" into "Upper" "Cased" "Words"
func StringsRuneChunk ¶
StringsRuneChunk returns an iterator over non overlapping sub strings of n utf8 characters.
func StringsSplitFunc ¶
StringsSplitFunc returns an iterator over sub string of s cut by splitFn. When n > 0, StringsSplitFunc cuts only n times and the returned iterator yields rest of string after n sub strings, if non empty. The sub strings from the iterator overlaps if splitFn decides so. splitFn is allowed to return negative offsets. In that case the returned iterator immediately yields rest of s and stops iteration.
func SyncMap ¶
SyncMap returns an iterator over m. Breaking Seq2 may stop producing more data, however it may still be O(N).
Types ¶
type FuncIterable ¶
func (FuncIterable[V]) IntoIter ¶
func (f FuncIterable[V]) IntoIter() iter.Seq[V]
func (FuncIterable[V]) Iter ¶
func (f FuncIterable[V]) Iter() iter.Seq[V]
type FuncIterable2 ¶
func (FuncIterable2[K, V]) IntoIter2 ¶
func (f FuncIterable2[K, V]) IntoIter2() iter.Seq2[K, V]
func (FuncIterable2[K, V]) Iter2 ¶
func (f FuncIterable2[K, V]) Iter2() iter.Seq2[K, V]
type IntoIterable ¶
IntoIterable wraps basic IntoIter2 method.
Calling IntoIter may mutate underlying state. Therefore calling the method again may also not yield same result.
type IntoIterable2 ¶
IntoIterable2 wraps basic IntoIter2 method.
Calling IntoIter2 may mutate underlying state. Therefore calling the method again may also not yield same result.
type Iterable ¶
Iterable wraps basic Iter method.
Iter should always return iterators that yield same set of data.
type Iterable2 ¶
Iterable2 wraps basic Iter2 method.
Iter2 should always return iterators that yield same set of data.
type StringsCutterFunc ¶
StringsCutterFunc is used to cut string from head. s[:tokUntil] is yielded through StringsSplitFunc. s[tokUntil:skipUntil] will be ignored.