Documentation ¶
Index ¶
- func All[V any](seq iter.Seq[V], f func(V) bool) bool
- func All2[K, V any](seq iter.Seq2[K, V], f func(K, V) bool) bool
- func Any[V any](seq iter.Seq[V], f func(V) bool) bool
- func Any2[K, V any](seq iter.Seq2[K, V], f func(K, V) bool) bool
- func AppendKVSlice2[S ~[]any, K, V any](s S, seq iter.Seq2[K, V]) S
- func AppendSlice[S ~[]V, V any](s S, seq iter.Seq[V]) S
- func AppendSlice2[S ~[]V, V any](s S, seq iter.Seq2[V, V]) S
- func AppendSliceMap[M ~map[K][]V, K comparable, V any](m M, seq iter.Seq2[K, V])
- func Cache[V any](seq iter.Seq[V]) (res iter.Seq[V], stop func())
- func Cache2[K, V any](seq iter.Seq2[K, V]) (res iter.Seq2[K, V], stop func())
- func Concat[V any](seqs ...iter.Seq[V]) iter.Seq[V]
- func Concat2[K, V any](seqs ...iter.Seq2[K, V]) iter.Seq2[K, V]
- func Contains[V comparable](seq iter.Seq[V], needle V) bool
- func Contains2[K, V comparable](seq iter.Seq2[K, V], needleK K, needleV V) bool
- func ContainsFunc[V any](seq iter.Seq[V], f func(V) bool) bool
- func ContainsFunc2[K, V any](seq iter.Seq2[K, V], f func(K, V) bool) bool
- func CopyToSlice[S ~[]V, V any](dst S, seq iter.Seq[V]) int
- func Count[V any](seq iter.Seq[V], f func(V) bool) int
- func Count2[K, V any](seq iter.Seq2[K, V], f func(K, V) bool) int
- func Cycle[V any](seq iter.Seq[V]) (iter.Seq[V], func())
- func Cycle2[K, V any](seq iter.Seq2[K, V]) (res iter.Seq2[K, V], stop func())
- func Deref[V any](seq iter.Seq[*V]) iter.Seq[V]
- func Drain[V any](seq iter.Seq[V])
- func Drain2[K, V any](seq iter.Seq2[K, V])
- func Drop[V any](seq iter.Seq[V], n int) iter.Seq[V]
- func Drop2[K, V any](seq iter.Seq2[K, V], n int) iter.Seq2[K, V]
- func DropWhile[V any](seq iter.Seq[V], f func(V) bool) iter.Seq[V]
- func DropWhile2[K, V any](seq iter.Seq2[K, V], f func(K, V) bool) iter.Seq2[K, V]
- func Empty[V any]() iter.Seq[V]
- func Empty2[K, V any]() iter.Seq2[K, V]
- func Enumerate[V any](seq iter.Seq[V]) iter.Seq2[int, V]
- func Equal[V comparable](seq1, seq2 iter.Seq[V]) bool
- func Equal2[K, V comparable](seq1, seq2 iter.Seq2[K, V]) bool
- func EqualFunc[V1, V2 any](seq1 iter.Seq[V1], seq2 iter.Seq[V2], f func(V1, V2) bool) bool
- func EqualFunc2[K1, V1, K2, V2 any](seq1 iter.Seq2[K1, V1], seq2 iter.Seq2[K2, V2], f func(K1, V1, K2, V2) bool) bool
- func Filter[V any](seq iter.Seq[V], f func(V) bool) iter.Seq[V]
- func Filter2[K, V any](seq iter.Seq2[K, V], f func(K, V) bool) iter.Seq2[K, V]
- func FilterErr[V any](seq iter.Seq[V], f func(V) (bool, error)) iter.Seq2[V, error]
- func FilterKey[K, V any](seq iter.Seq2[K, V], f func(K) bool) iter.Seq2[K, V]
- func FilterKeyNotEqual[K comparable, V any](seq iter.Seq2[K, V], kNotEq K) iter.Seq2[K, V]
- func FilterNotEqual[V comparable](seq iter.Seq[V], notEq V) iter.Seq[V]
- func FilterNotEqual2[K, V comparable](seq iter.Seq2[K, V], kNotEq K, vNotEq V) iter.Seq2[K, V]
- func FilterValue[K, V any](seq iter.Seq2[K, V], f func(V) bool) iter.Seq2[K, V]
- func FilterValueNotEqual[K any, V comparable](seq iter.Seq2[K, V], vNotEq V) iter.Seq2[K, V]
- func Find[V any](seq iter.Seq[V], f func(V) bool) (V, bool)
- func Find2[K, V any](seq iter.Seq2[K, V], f func(K, V) bool) (K, V, bool)
- func FindByKey[K, V any](seq iter.Seq2[K, V], f func(K) bool) (K, V, bool)
- func FindByValue[K, V any](seq iter.Seq2[K, V], f func(V) bool) (K, V, bool)
- func Flatmap[In, Out any](seq iter.Seq[In], f func(In) iter.Seq[Out]) iter.Seq[Out]
- func Flatmap2[KIn, VIn, KOut, VOut any](seq iter.Seq2[KIn, VIn], f func(KIn, VIn) iter.Seq2[KOut, VOut]) iter.Seq2[KOut, VOut]
- func Flatten[V any](seq iter.Seq[iter.Seq[V]]) iter.Seq[V]
- func Flatten2[K, V any](seq iter.Seq[iter.Seq2[K, V]]) iter.Seq2[K, V]
- func Foreach[V any](seq iter.Seq[V], f func(V))
- func Foreach2[K, V any](seq iter.Seq2[K, V], f func(K, V))
- func Grouped[V any](seq iter.Seq[V], n int) iter.Seq[[]V]
- func GroupedNoCopy[V any](seq iter.Seq[V], n int) iter.Seq[[]V]
- func Index[V any](seq iter.Seq[V], idx int) V
- func Index2[K, V any](seq iter.Seq2[K, V], idx int) (K, V)
- func IntoChan[C ~chan<- V, V any](c C, seq iter.Seq[V])
- func Join[V ~string](seq iter.Seq[V], sep string) string
- func Keys[K, V any](seq iter.Seq2[K, V]) iter.Seq[K]
- func Len[V any](s iter.Seq[V]) int
- func Len2[K, V any](s iter.Seq2[K, V]) int
- func Map[In, Out any](seq iter.Seq[In], f func(In) Out) iter.Seq[Out]
- func Map2[KIn, VIn, KOut, VOut any](seq iter.Seq2[KIn, VIn], f func(KIn, VIn) (KOut, VOut)) iter.Seq2[KOut, VOut]
- func MapErr[In, Out any](seq iter.Seq[In], f func(In) (Out, error)) iter.Seq2[Out, error]
- func MapKeys[KIn, V, KOut any](seq iter.Seq2[KIn, V], f func(KIn) KOut) iter.Seq2[KOut, V]
- func MapLift[In, KOut, VOut any](seq iter.Seq[In], f func(In) (KOut, VOut)) iter.Seq2[KOut, VOut]
- func MapLower[KIn, VIn, VOut any](seq iter.Seq2[KIn, VIn], f func(KIn, VIn) VOut) iter.Seq[VOut]
- func MapValues[K, VIn, VOut any](seq iter.Seq2[K, VIn], f func(VIn) VOut) iter.Seq2[K, VOut]
- func Max[V cmp.Ordered](seq iter.Seq[V]) V
- func MaxFunc[V cmp.Ordered](seq iter.Seq[V], compare func(a, b V) int) V
- func MaxOk[V cmp.Ordered](seq iter.Seq[V]) (V, bool)
- func MaxOkFunc[V cmp.Ordered](seq iter.Seq[V], compare func(a, b V) int) (V, bool)
- func Merge[K, V any](seq1 iter.Seq[K], seq2 iter.Seq[V]) iter.Seq2[K, V]
- func MergeAll[K, V any](seq1 iter.Seq[K], seq2 iter.Seq[V], defV1 K, defV2 V) iter.Seq2[K, V]
- func MergeAllFunc[K, V any](seq1 iter.Seq[K], seq2 iter.Seq[V], defV1Func func() K, defV2Func func() V) iter.Seq2[K, V]
- func Min[V cmp.Ordered](seq iter.Seq[V]) V
- func MinFunc[V cmp.Ordered](seq iter.Seq[V], compare func(a, b V) int) V
- func MinOk[V cmp.Ordered](seq iter.Seq[V]) (V, bool)
- func MinOkFunc[V cmp.Ordered](seq iter.Seq[V], compare func(a, b V) int) (V, bool)
- func Of[V any](vs ...V) iter.Seq[V]
- func OfChan[C interface{ ... }, V any](c C) iter.Seq[V]
- func OfKVSlice[K, V any, S ~[]any](s S) iter.Seq2[K, V]
- func OfKVs[K, V any](kvs ...any) iter.Seq2[K, V]
- func OfMap[M ~map[K]V, K comparable, V any](m M) iter.Seq2[K, V]
- func OfMapKeys[M ~map[K]V, K comparable, V any](m M) iter.Seq[K]
- func OfMapValues[M ~map[K]V, K comparable, V any](m M) iter.Seq[V]
- func OfNext[V any](f func() (V, bool)) iter.Seq[V]
- func OfNext2[K, V any](f func() (K, V, bool)) iter.Seq2[K, V]
- func OfSlice[S ~[]V, V any](s S) iter.Seq[V]
- func OfSliceIndex[S ~[]V, V any](s S) iter.Seq2[int, V]
- func OfSlicePtr[S ~[]V, V any](s S) iter.Seq[*V]
- func OfSlicePtrIndex[S ~[]V, V any](s S) iter.Seq2[int, *V]
- func Range(start, end int) iter.Seq[int]
- func RangeStep(start, end, step int) iter.Seq[int]
- func Receive[C interface{ ... }, V any](ctx context.Context, c C) iter.Seq[V]
- func Reduce[Sum, V any](sum Sum, seq iter.Seq[V], f func(Sum, V) Sum) Sum
- func Reduce2[Sum, K, V any](sum Sum, seq iter.Seq2[K, V], f func(Sum, K, V) Sum) Sum
- func Ref[V any](seq iter.Seq[V]) iter.Seq[*V]
- 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 Send[C interface{ ... }, V any](ctx context.Context, c C, seq iter.Seq[V])
- func SendChan[V any](ctx context.Context, seq iter.Seq[V]) <-chan V
- func Separate[K, V any](seq iter.Seq2[K, V]) (iter.Seq[K], iter.Seq[V], func())
- func SetMap[M ~map[K]V, K comparable, V any](m M, seq iter.Seq2[K, V])
- func Sum[V cmp.Ordered](seq iter.Seq[V]) V
- func Swap[K, V any](seq iter.Seq2[K, V]) iter.Seq2[V, K]
- func Take[V any](seq iter.Seq[V], n int) iter.Seq[V]
- func Take2[K, V any](seq iter.Seq2[K, V], n int) iter.Seq2[K, V]
- func TakeWhile[V any](seq iter.Seq[V], f func(V) bool) iter.Seq[V]
- func TakeWhile2[K, V any](seq iter.Seq2[K, V], f func(K, V) bool) iter.Seq2[K, V]
- func Tap[V any](seq iter.Seq[V], f func(V)) iter.Seq[V]
- func Tap2[K, V any](seq iter.Seq2[K, V], f func(K, V)) iter.Seq2[K, V]
- func TapKey[K, V any](seq iter.Seq2[K, V], f func(K)) iter.Seq2[K, V]
- func TapValue[K, V any](seq iter.Seq2[K, V], f func(V)) iter.Seq2[K, V]
- func ToChan[V any](seq iter.Seq[V]) <-chan V
- func ToKVSlice[K, V any](seq iter.Seq2[K, V]) []any
- func ToList[V any](seq iter.Seq[V]) *list.List
- func ToMap[K comparable, V any](seq iter.Seq2[K, V]) map[K]V
- func ToSlice[V any](seq iter.Seq[V]) []V
- func ToSlice2[V any](seq iter.Seq2[V, V]) []V
- func ToSliceMap[K comparable, V any](seq iter.Seq2[K, V]) map[K][]V
- func ToSliceWithCap[V any](seq iter.Seq[V], cap int) []V
- func ToSliceWithCap2[V any](seq iter.Seq2[V, V], cap int) []V
- func TryAppend[S ~[]K, K any](s S, it iter.Seq2[K, error]) ([]K, error)
- func TryAppendDeref[S ~[]K, K any](s S, it iter.Seq2[*K, error]) ([]K, error)
- func TryCollect[K any](it iter.Seq2[K, error]) ([]K, error)
- func TryCollectDeref[K any](it iter.Seq2[*K, error]) ([]K, error)
- func TryCollectDerefWithCap[K any](it iter.Seq2[*K, error], cap int) ([]K, error)
- func TryCollectWithCap[K any](it iter.Seq2[K, error], cap int) ([]K, error)
- func TryFilter[K any](seq iter.Seq2[K, error], f func(K) bool) iter.Seq2[K, error]
- func TryFilterErr[K any](seq iter.Seq2[K, error], f func(K) (bool, error)) iter.Seq2[K, error]
- func TryFlatmap[In, Out any](seq iter.Seq2[In, error], f func(In) iter.Seq[Out]) iter.Seq2[Out, error]
- func TryFlatmapErr[In, Out any](seq iter.Seq2[In, error], f func(In) iter.Seq2[Out, error]) iter.Seq2[Out, error]
- func TryMap[In, Out any](seq iter.Seq2[In, error], f func(In) Out) iter.Seq2[Out, error]
- func TryMapErr[In, Out any](seq iter.Seq2[In, error], f func(In) (Out, error)) iter.Seq2[Out, error]
- func TryTap[K any](seq iter.Seq2[K, error], f func(K)) iter.Seq2[K, error]
- func Unzip[V1, V2 any](seq iter.Seq[Zipped[V1, V2]]) (iter.Seq[V1], iter.Seq[V2], func())
- func Unzip2[K1, V1, K2, V2 any](seq iter.Seq[Zipped2[K1, V1, K2, V2]]) (iter.Seq2[K1, V1], iter.Seq2[K2, V2], func())
- func Values[K, V any](seq iter.Seq2[K, V]) iter.Seq[V]
- func Zip[V1, V2 any](seq1 iter.Seq[V1], seq2 iter.Seq[V2]) iter.Seq[Zipped[V1, V2]]
- func Zip2[K1, V1, K2, V2 any](seq1 iter.Seq2[K1, V1], seq2 iter.Seq2[K2, V2]) iter.Seq[Zipped2[K1, V1, K2, V2]]
- type Zipped
- type Zipped2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendSlice ¶
func AppendSlice2 ¶
func AppendSliceMap ¶
func AppendSliceMap[M ~map[K][]V, K comparable, V any](m M, seq iter.Seq2[K, V])
func Equal ¶
func Equal[V comparable](seq1, seq2 iter.Seq[V]) bool
Equal checks if two Seq sequences are equal by iterating and checking if both have the same length and values.
func Equal2 ¶
func Equal2[K, V comparable](seq1, seq2 iter.Seq2[K, V]) bool
Equal2 checks if two Seq2 sequences are equal by iterating and checking if both have the same length and values.
func EqualFunc2 ¶
func FilterErr ¶
FilterErr filters the sequence with the predicate function. If it errors, the error and the value it errored for is yielded.
func FilterKeyNotEqual ¶
func FilterNotEqual ¶
func FilterNotEqual[V comparable](seq iter.Seq[V], notEq V) iter.Seq[V]
func FilterNotEqual2 ¶
func FilterNotEqual2[K, V comparable](seq iter.Seq2[K, V], kNotEq K, vNotEq V) iter.Seq2[K, V]
func FilterValueNotEqual ¶
func Merge ¶
Merge returns a sequence that is the result of merging both sequence values. If one of both sequences do not yield a value anymore, the sequence returns.
func MergeAllFunc ¶
func OfMapValues ¶
func OfMapValues[M ~map[K]V, K comparable, V any](m M) iter.Seq[V]
func OfSlicePtr ¶
OfSlicePtr iterates over pointers of the slice elements.
func OfSlicePtrIndex ¶
OfSlicePtrIndex iterates over pointers and indices of the slice elements.
func ToSliceMap ¶
func ToSliceMap[K comparable, V any](seq iter.Seq2[K, V]) map[K][]V
func TryAppend ¶
TryAppend appends non-error values to the given slice. If an error is encountered, the slice and encountered error are returned immediately.
func TryAppendDeref ¶
TryAppendDeref appends dereferenced non-error values to the given slice. If an error is encountered, the slice and encountered error are returned immediately.
func TryCollect ¶
TryCollect collects non-error values in a slice. If an error is encountered, the slice and encountered error are returned immediately.
func TryCollectDeref ¶
TryCollectDeref collects dereferenced non-error values in a slice. If an error is encountered, the slice and encountered error are returned immediately.
func TryCollectDerefWithCap ¶
TryCollectDerefWithCap collects dereferenced non-error values in a slice with the given capacity. If an error is encountered, the slice and encountered error are returned immediately.
func TryCollectWithCap ¶
TryCollectWithCap collects non-error values in a slice with the given capacity. If an error is encountered, the slice and encountered error are returned immediately.
func TryFilter ¶
TryFilter filters non-error tuples with the given predicate function. For error-tuples, the filter is not applied and yield is called with the error and the value.
func TryFilterErr ¶
TryFilterErr filters non-error tuples with the given predicate function. For error-tuples, the filter is not applied and yield is called with the error and the value. If the predicate function errors, the value it errored for and the error is yielded.
func TryFlatmap ¶
func TryFlatmap[In, Out any](seq iter.Seq2[In, error], f func(In) iter.Seq[Out]) iter.Seq2[Out, error]
TryFlatmap maps non-error tuples with the given function, flattening the result. For error-tuples, the function is not applied and yield is called with the error and the zero Out value.
func TryFlatmapErr ¶
func TryFlatmapErr[In, Out any](seq iter.Seq2[In, error], f func(In) iter.Seq2[Out, error]) iter.Seq2[Out, error]
TryFlatmapErr maps non-error tuples with the given function, flattening the result. For error-tuples, the function is not applied and yield is called with the error and the zero Out value.
func TryMap ¶
TryMap maps non-error tuples with the given function. For error-tuples, the function is not applied and yield is called with the error and the zero Out value.
func TryMapErr ¶
func TryMapErr[In, Out any](seq iter.Seq2[In, error], f func(In) (Out, error)) iter.Seq2[Out, error]
TryMapErr applies the transformation function f to each non-error tuple of the given sequence. For error-tuples, the function is not applied and yield is called with the error and the zero value of Out.
func Zip ¶
Zip combines two sequences into a single sequence by yielding zipped pairs of elements from each sequence. The returned sequence will produce a Zipped struct for each pair of elements, containing the value and presence flag for each sequence. The sequences will be zipped until both sequences are exhausted or the yield function returns false. If the yield function returns false, the zipping will stop and the function will return. After the first sequence is exhausted, the remaining elements of the second sequence will be paired with default values and presence flags.
func Zip2 ¶
func Zip2[K1, V1, K2, V2 any](seq1 iter.Seq2[K1, V1], seq2 iter.Seq2[K2, V2]) iter.Seq[Zipped2[K1, V1, K2, V2]]
Zip2 combines two sequences into a single sequence by yielding zipped pairs of elements from each sequence. The returned sequence will produce a Zipped2 struct for each pair of elements, containing the value and presence flag for each sequence. The sequences will be zipped until both sequences are exhausted or the yield function returns false. If the yield function returns false, the zipping will stop and the function will return. After the first sequence is exhausted, the remaining elements of the second sequence will be paired with default values and presence flags.