Documentation
¶
Index ¶
- func After[V any](seq iter.Seq[V], f func()) iter.Seq[V]
- func After2[K, V any](seq iter.Seq2[K, V], f func()) iter.Seq2[K, V]
- 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 Before[V any](seq iter.Seq[V], f func()) iter.Seq[V]
- func Before2[K, V any](seq iter.Seq2[K, V], f func()) 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 Cast[Out, In any](seq iter.Seq[In]) iter.Seq[Out]
- func CastOrError[Out, In any](seq iter.Seq[In]) iter.Seq2[Out, error]
- 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 LiftFailure[V any](seq iter.Seq[error]) iter.Seq2[V, error]
- func LiftSuccess[V any](seq iter.Seq[V]) iter.Seq2[V, error]
- 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 OfFlattenSlice[SS ~[]S, S ~[]V, V any](ss SS) 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]) (S, error)
- func TryAppendDeref[S ~[]K, K any](s S, it iter.Seq2[*K, error]) (S, error)
- func TryCast[Out, In any](seq iter.Seq2[In, error]) iter.Seq2[Out, error]
- func TryCastOrError[Out, In any](seq iter.Seq2[In, error]) iter.Seq2[Out, 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 TryFlatAppend[S ~[]K, K any](s S, it iter.Seq2[iter.Seq[K], error]) (S, error)
- func TryFlatCollect[K any](it iter.Seq2[iter.Seq[K], error]) ([]K, error)
- func TryFlatCollectWithCap[K any](it iter.Seq2[iter.Seq[K], error], cap int) ([]K, error)
- func TryFlatSliceAppend[S ~[]K, SI []K, K any](s S, it iter.Seq2[SI, error]) (S, error)
- func TryFlatSliceCollect[K any](it iter.Seq2[[]K, error]) ([]K, error)
- func TryFlatSliceCollectWithCap[K any](it iter.Seq2[[]K, error], cap int) ([]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 Wrap[V any](seq iter.Seq[V], wrap func(doSeq func())) iter.Seq[V]
- func Wrap2[K, V any](seq iter.Seq2[K, V], wrap func(doSeq func())) iter.Seq2[K, V]
- func YieldMap[M ~map[K]V, K comparable, V any](yield func(K, V) bool, ms ...M) bool
- func YieldSeq[V any](yield func(V) bool, seqs ...iter.Seq[V]) bool
- func YieldSeq2[K, V any](yield func(K, V) bool, seqs ...iter.Seq2[K, V]) bool
- func YieldSlice[S ~[]V, V any](yield func(V) bool, ss ...S) bool
- 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 KVSeqBuilder
- type Zipped
- type Zipped2
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func After ¶
After wraps the given seq by calling the given function after the iteration.
Example ¶
wrapped := After(Of(1, 2, 3), func() { fmt.Println("After!") }) Foreach(wrapped, func(i int) { fmt.Println(i) })
Output: 1 2 3 After!
func After2 ¶
After2 wraps the given seq by calling the given function after the iteration.
Example ¶
wrapped := After2(OfKVs[int, int](1, 1, 2, 2, 3, 3), func() { fmt.Println("After!") }) Foreach2(wrapped, func(i1, i2 int) { fmt.Println(i1, i2) })
Output: 1 1 2 2 3 3 After!
func AppendSlice ¶
func AppendSlice2 ¶
func AppendSliceMap ¶
func AppendSliceMap[M ~map[K][]V, K comparable, V any](m M, seq iter.Seq2[K, V])
func Before ¶
Before wraps the given seq by calling the given function before the iteration.
Example ¶
wrapped := Before(Of(1, 2, 3), func() { fmt.Println("Before!") }) Foreach(wrapped, func(i int) { fmt.Println(i) })
Output: Before! 1 2 3
func Before2 ¶
Before2 wraps the given seq by calling the given function before the iteration.
Example ¶
wrapped := Before2(OfKVs[int, int](1, 1, 2, 2, 3, 3), func() { fmt.Println("Before!") }) Foreach2(wrapped, func(i1, i2 int) { fmt.Println(i1, i2) })
Output: Before! 1 1 2 2 3 3
func CastOrError ¶
CastOrError casts In values to Out values if possible, yielding errors if the cast is not possible.
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 LiftFailure ¶
LiftFailure returns an iter.Seq2[V, error] with all V values as zero.
func LiftSuccess ¶
LiftSuccess returns an iter.Seq2[V, error] with all error values as nil.
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 OfFlattenSlice ¶
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 TryCastOrError ¶
TryCastOrError casts non-error In values to Out values. It panics if any cast fails.
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 TryFlatAppend ¶
TryFlatAppend appends non-error values to the given slice, flattening the result in the process. If an error is encountered, the slice and encountered error are returned immediately.
func TryFlatCollect ¶
TryFlatCollect collects non-error values in a slice, flattening the result in the process. If an error is encountered, the slice and encountered error are returned immediately.
func TryFlatCollectWithCap ¶
TryFlatCollectWithCap collects non-error values into a slice with the given capacity, flattening the result in the process. If an error is encountered, the slice and encountered error are returned immediately.
func TryFlatSliceAppend ¶
TryFlatSliceAppend appends non-error values to the given slice, flattening the result in the process. If an error is encountered, the slice and encountered error are returned immediately.
func TryFlatSliceCollect ¶
TryFlatSliceCollect collects non-error values in a slice, flattening the result in the process. If an error is encountered, the slice and encountered error are returned immediately.
func TryFlatSliceCollectWithCap ¶
TryFlatSliceCollectWithCap collects non-error values into a slice with the given capacity, flattening the result in the process. If an error is encountered, the slice and encountered error are returned immediately.
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 Wrap ¶
Wrap wraps the given seq with the wrap function. The wrap function must call the passed doSeq function to trigger the iteration.
Example ¶
wrapped := Wrap(Of(1, 2, 3), func(doSeq func()) { fmt.Println("Before!") doSeq() fmt.Println("After!") }) Foreach(wrapped, func(i int) { fmt.Println(i) })
Output: Before! 1 2 3 After!
func Wrap2 ¶
Wrap2 wraps the given seq with the wrap function. The wrap function must call the passed doSeq function to trigger the iteration.
Example ¶
wrapped := Wrap2(OfKVs[int, int](1, 1, 2, 2, 3, 3), func(doSeq func()) { fmt.Println("Before!") doSeq() fmt.Println("After!") }) Foreach2(wrapped, func(i1, i2 int) { fmt.Println(i1, i2) })
Output: Before! 1 1 2 2 3 3 After!
func YieldMap ¶
func YieldMap[M ~map[K]V, K comparable, V any](yield func(K, V) bool, ms ...M) bool
YieldMap yields the given map to the yield function, breaking and returning if any yield returned false.
func YieldSeq ¶
YieldSeq yields the given seqs to the yield function, breaking and returning if any yield returned false.
func YieldSeq2 ¶
YieldSeq2 yields the given seqs to the yield function, breaking and returning if any yield returned false.
func YieldSlice ¶
YieldSlice yields the given slice to the yield function, breaking and returning if any yield returned false.
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.
Types ¶
type KVSeqBuilder ¶
type KVSeqBuilder[K, V any] struct { // contains filtered or unexported fields }
func OfKV ¶
func OfKV[K, V any]() *KVSeqBuilder[K, V]
OfKV offers a simplistic builder for iter.Seq2[K, V]. Simply add some elements via the addition functions and call KVSeqBuilder.Seq to obtain the Seq.
func (*KVSeqBuilder[K, V]) K ¶
func (b *KVSeqBuilder[K, V]) K(ks ...K) *KVSeqBuilder[K, V]
func (*KVSeqBuilder[K, V]) P ¶
func (b *KVSeqBuilder[K, V]) P(k K, v V) *KVSeqBuilder[K, V]
func (*KVSeqBuilder[K, V]) Seq ¶
func (b *KVSeqBuilder[K, V]) Seq() iter.Seq2[K, V]
func (*KVSeqBuilder[K, V]) V ¶
func (b *KVSeqBuilder[K, V]) V(vs ...V) *KVSeqBuilder[K, V]