Documentation ¶
Overview ¶
Package flow implements functionality similar to Java 8 Streams.
It uses Go 1.23's iterator and generic type support.
Index ¶
- func Chain[V any](input iter.Seq[V], steps ...Step[V]) iter.Seq[V]
- func Chain2[K, V any](input iter.Seq2[K, V], steps ...Step2[K, V]) iter.Seq2[K, V]
- func Parallel[V any](num int, input iter.Seq[V], steps ...Step[V]) iter.Seq[V]
- func Parallel2[K, V any](num int, input iter.Seq2[K, V], steps ...Step2[K, V]) iter.Seq2[K, V]
- type Step
- func Append[V any](items ...V) Step[V]
- func CenteredMovingAvg[V stats.Number](size int) Step[V]
- func Concat[V any](seqs ...iter.Seq[V]) Step[V]
- func Distinct[V comparable]() Step[V]
- func DropWhile[V any](predicate func(V) bool) Step[V]
- func Filter[V any](predicate func(V) bool) Step[V]
- func Limit[V any](limit int) Step[V]
- func Map[V any](maper func(V) V) Step[V]
- func Merge[V any](seqs ...iter.Seq[V]) Step[V]
- func MovingAvg[V stats.Number](size int) Step[V]
- func Peek[V any](action func(V)) Step[V]
- func Prepend[V any](items ...V) Step[V]
- func Repeat[V any](count int) Step[V]
- func Reverse[V any]() Step[V]
- func Shuffle[V any]() Step[V]
- func Skip[V any](num int) Step[V]
- func Sort[V cmp.Ordered]() Step[V]
- func SortFunc[V any](cmp func(V, V) int) Step[V]
- func SortStableFunc[V any](cmp func(V, V) int) Step[V]
- func TakeWhile[V any](predicate func(V) bool) Step[V]
- type Step2
- func Append2[K, V any](items ...seq.Tuple[K, V]) Step2[K, V]
- func Concat2[K, V any](seqs ...iter.Seq2[K, V]) Step2[K, V]
- func Distinct2[K comparable, V any]() Step2[K, V]
- func DropWhile2[K, V any](predicate func(K, V) bool) Step2[K, V]
- func Filter2[K, V any](predicate func(K, V) bool) Step2[K, V]
- func Limit2[K, V any](limit int) Step2[K, V]
- func Map2[K, V any](maper func(K, V) (K, V)) Step2[K, V]
- func Merge2[K, V any](seqs ...iter.Seq2[K, V]) Step2[K, V]
- func Peek2[K, V any](action func(K, V)) Step2[K, V]
- func Prepend2[K, V any](items ...seq.Tuple[K, V]) Step2[K, V]
- func Repeat2[K, V any](count int) Step2[K, V]
- func Reverse2[K, V any]() Step2[K, V]
- func Shuffle2[K, V any]() Step2[K, V]
- func Skip2[K, V any](num int) Step2[K, V]
- func Sort2[K cmp.Ordered, V any]() Step2[K, V]
- func SortFunc2[K, V any](cmp func(seq.Tuple[K, V], seq.Tuple[K, V]) int) Step2[K, V]
- func SortStableFunc2[K, V any](cmp func(seq.Tuple[K, V], seq.Tuple[K, V]) int) Step2[K, V]
- func TakeWhile2[K, V any](predicate func(K, V) bool) Step2[K, V]
Examples ¶
- Append
- Append2
- CenteredMovingAvg
- Chain
- Chain (MapChangeType)
- Chain2
- Concat
- Concat2
- Distinct
- Distinct2
- DropWhile
- DropWhile2
- Filter
- Filter2
- Limit
- Limit2
- Map
- Map2
- Merge
- Merge2
- MovingAvg
- Parallel
- Parallel2
- Peek
- Peek2
- Prepend
- Prepend2
- Repeat
- Repeat2
- Reverse
- Reverse2
- Shuffle
- Shuffle2
- Skip
- Skip2
- Sort
- Sort2
- SortFunc
- SortFunc2
- SortStableFunc
- SortStableFunc2
- TakeWhile
- TakeWhile2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chain ¶
Chain applies a series of transformation steps to the input sequence sequentially.
It takes an input sequence `input` and a variadic list of `steps`. Each step is applied sequentially to the input sequence.
Play: https://go.dev/play/p/JydmjWYw9rw
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for num := range flow.Chain( seq.Range(100), flow.Limit[int](10), flow.Filter(func(num int) bool { return num%3 == 0 }), flow.Map(func(num int) int { return num * 2 }), ) { fmt.Println(num) } }
Output: 0 6 12 18
Example (MapChangeType) ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { items := flow.Chain( seq.Range(100), flow.Limit[int](10), flow.Filter(func(num int) bool { return num%2 == 0 }), ) for str := range flow.Chain( seq.Map(items, func(num int) string { return fmt.Sprintf("num:%d", num) }), flow.Limit[string](2), ) { fmt.Println(str) } }
Output: num:0 num:2
func Chain2 ¶ added in v0.0.5
Chain2 applies multiple Step2 functions sequentially to the input sequence.
It returns the final sequence after applying all steps.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for key, val := range flow.Chain2( seq.Range2(100), flow.Filter2(func(key, _ int) bool { return key%2 == 0 }), flow.Limit2[int, int](2), ) { fmt.Println(key, val) } }
Output: 0 0 2 2
func Parallel ¶
Parallel processes the input sequence using multiple workers and applies a series of steps.
It returns a new sequence with the processed results.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for num := range flow.Parallel(2, seq.Range(100), flow.Limit[int](8), flow.Filter(func(num int) bool { return num%3 == 0 }), flow.Sort[int](), ) { if num > 3 { break } fmt.Println(num) } }
Output: 0 3
func Parallel2 ¶ added in v0.0.5
Parallel2 processes the input sequence in parallel using multiple workers.
It returns a new sequence with the processed results.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for key, val := range flow.Parallel2(2, seq.Range2(100), flow.Limit2[int, int](8), flow.Filter2(func(key, _ int) bool { return key%3 == 0 }), flow.Sort2[int, int](), ) { if key > 3 { break } fmt.Println(key, val) } }
Output: 0 0 3 3
Types ¶
type Step ¶
Step represents a processing step in an iterator.
It includes a Next function to perform the next operation on a sequence, and a Parallel boolean indicating whether it can be executed in parallel.
func Append ¶ added in v0.0.5
Append adds multiple elements to the end of a sequence.
It takes a variable number of elements and appends them to the input sequence.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for num := range flow.Chain( seq.Range(2), flow.Append(9), ) { fmt.Println(num) } }
Output: 0 1 9
func CenteredMovingAvg ¶ added in v0.0.10
CenteredMovingAvg creates a step that calculates the centered moving average of a sequence.
It computes the average of `size` consecutive elements, centered when possible.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for num := range flow.Chain( seq.Range(5), flow.CenteredMovingAvg[int](3), ) { fmt.Println(num) } }
Output: 1 2 3 3 3
func Concat ¶ added in v0.0.14
Concat combines multiple sequence iterators into a single sequence iterator.
It returns a Step[V] that concatenates the provided sequences with an input sequence.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for num := range flow.Chain( seq.Range(3), flow.Concat(seq.Seq(7, 8)), ) { fmt.Println(num) } }
Output: 0 1 2 7 8
func Distinct ¶ added in v0.0.3
func Distinct[V comparable]() Step[V]
Distinct returns a transformation step that filters out duplicate elements from a sequence.
It returns a `Step` that can be used to create a new sequence containing only the distinct elements from the input sequence.
Example ¶
package main import ( "fmt" "slices" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.Sum(flow.Chain( slices.Values([]int{1, 2, 2, 3, 3}), flow.Distinct[int](), ))) }
Output: 6
func DropWhile ¶ added in v0.0.8
It returned Step[V] can be used in a pipeline to process sequences.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for num := range flow.Chain( seq.Range(4), flow.DropWhile(func(num int) bool { return num < 2 }), ) { fmt.Println(num) } }
Output: 2 3
func Filter ¶
Filter returns a transformation step that filters elements based on a predicate.
It returns a `Step` that can be used to create a new sequence containing only the elements that satisfy the given `predicate`.
Play: https://go.dev/play/p/JydmjWYw9rw
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.Sum(flow.Chain( seq.Range(10), flow.Filter(func(i int) bool { return i%3 == 0 }), ))) }
Output: 18
func Limit ¶
Limit returns a transformation step that limits the number of elements in a sequence.
It returns a `Step` that creates a new sequence containing at most `limit` elements from the input sequence.
Play: https://go.dev/play/p/JydmjWYw9rw
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.Sum(flow.Chain( seq.Range(10), flow.Limit[int](4), ))) }
Output: 6
func Map ¶ added in v0.0.9
Map creates a new step that applies a transformation function to each element of an input sequence.
It returns a Step that can be used in a pipeline to map over the input sequence.
Note:
Cannot change type.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for num := range flow.Chain( seq.Range(3), flow.Map(func(num int) int { return num * 2 }), ) { fmt.Println(num) } }
Output: 0 2 4
func Merge ¶ added in v0.0.5
Merge combines multiple sequences into a single sequence.
It merges the input sequence with additional sequences.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.Count(flow.Chain( seq.Range(3), flow.Merge(seq.Range(4), seq.Range(2)), ))) fmt.Println(seq.Count(flow.Chain( seq.Range(3), flow.Merge[int](), ))) }
Output: 9 3
func MovingAvg ¶ added in v0.0.10
MovingAvg creates a step that calculates the moving average of a sequence.
It computes the average of every `size` consecutive elements in the input.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for num := range flow.Chain( seq.Range(5), flow.MovingAvg[int](3), ) { fmt.Println(num) } }
Output: 0 0 1 2 3
func Peek ¶
Peek returns a transformation step that applies an action to each element in the sequence.
It returns a `Step` that calls the `action` function on each element of the input sequence without modifying the sequence itself.
Play: https://go.dev/play/p/0YiWlMdzwMk
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { seq.Emit(flow.Chain( seq.Range(3), flow.Peek(func(num int) { fmt.Println(num) }), )) }
Output: 0 1 2
func Prepend ¶ added in v0.0.8
Prepend creates a step that adds items to the beginning of a sequence.
It function is useful for creating a prepending step in a pipeline.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for num := range flow.Chain( seq.Range(2), flow.Prepend(9), ) { fmt.Println(num) } }
Output: 9 0 1
func Repeat ¶ added in v0.0.6
Repeat creates a new step that repeats the input sequence a specified number of times.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.Count(flow.Chain( seq.Range(3), flow.Repeat[int](4), ))) }
Output: 12
func Reverse ¶
Reverse returns a transformation step that reverses the order of elements in a sequence.
It returns a `Step` that creates a new sequence with the elements in reverse order.
Play: https://go.dev/play/p/JydmjWYw9rw
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.First(flow.Chain( seq.Range(100), flow.Reverse[int](), ))) }
Output: 99 true
func Shuffle ¶ added in v0.0.9
Shuffle creates a step that shuffles the input sequence.
It returns a Step that, when applied, yields elements in a random order.
Example ¶
package main import ( "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { seq.Emit(flow.Chain( seq.Range(3), flow.Shuffle[int](), )) }
Output:
func Skip ¶
Skip returns a transformation step that skips the first `num` elements in a sequence.
It returns a `Step` that creates a new sequence by skipping the first `num` elements of the input sequence.
Play: https://go.dev/play/p/JydmjWYw9rw
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.First(flow.Chain( seq.Range(100), flow.Skip[int](99), ))) }
Output: 99 true
func Sort ¶
Sort returns a transformation step that sorts the elements in a sequence.
It returns a `Step` function that sorts the sequence.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.First(flow.Chain( seq.Range(100), flow.Reverse[int](), flow.Sort[int](), ))) }
Output: 0 true
func SortFunc ¶
SortFunc returns a transformation step that sorts the elements in a sequence using a custom comparison function.
It returns a `Step` that creates a new sequence with the elements sorted according to the `cmp` function.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.First(flow.Chain( seq.Range(100), flow.SortFunc(func(num1, num2 int) int { return num2 - num1 }), ))) }
Output: 99 true
func SortStableFunc ¶ added in v0.0.5
SortStableFunc sorts the elements in the sequence using a custom comparison function with stable sorting.
It returns a `Step` function that sorts the sequence.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.First(flow.Chain( seq.Range(100), flow.SortStableFunc(func(num1, num2 int) int { return num2 - num1 }), ))) }
Output: 99 true
func TakeWhile ¶ added in v0.0.8
TakeWhile creates a Step[V] that filters elements from 'input' using 'predicate'.
It yields elements until the predicate is false for the first time.
The returned Step[V] can be used in a pipeline to process sequences.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for num := range flow.Chain( seq.Range(4), flow.TakeWhile(func(num int) bool { return num < 2 }), ) { fmt.Println(num) } }
Output: 0 1
type Step2 ¶ added in v0.0.5
Step2 represents a processing step in an iterator for sequences with two types K and V.
It includes a Next function to perform the next operation on a sequence, and a Parallel boolean indicating whether it can be executed in parallel.
func Append2 ¶ added in v0.0.5
Append2 appends additional (key, value) tuples to the input sequence.
It returns a new sequence with the appended tuples.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for key, val := range flow.Chain2( seq.Range2(2), flow.Append2(seq.T(7, 8)), ) { fmt.Println(key, val) } }
Output: 0 0 1 1 7 8
func Concat2 ¶ added in v0.0.14
Concat2 combines multiple key-value sequence iterators into a single step.
It returns a Step2[K, V] that concatenates the provided sequences with an input sequence.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for key, val := range flow.Chain2( seq.Range2(3), flow.Concat2(seq.Seq2(seq.T(7, 70), seq.T(8, 80))), ) { fmt.Println(key, val) } }
Output: 0 0 1 1 2 2 7 70 8 80
func Distinct2 ¶ added in v0.0.5
func Distinct2[K comparable, V any]() Step2[K, V]
Distinct2 removes duplicate (key, value) pairs from the sequence.
It returns a `Step2` function that filters duplicates.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.Count2(flow.Chain2( seq.Range2(3), flow.Append2(seq.T(2, 7), seq.T(8, 4)), flow.Distinct2[int, int](), ))) }
Output: 4
func DropWhile2 ¶ added in v0.0.8
DropWhile2 creates a Step2[K, V] that skips key-value pairs from 'input' as long as 'predicate' returns true.
Once the predicate is false, it starts yielding pairs.
It returned Step2[K, V] can be used in a pipeline to process sequences of key-value pairs.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for key, val := range flow.Chain2( seq.Range2(4), flow.DropWhile2(func(key, _ int) bool { return key < 2 }), ) { fmt.Println(key, val) } }
Output: 2 2 3 3
func Filter2 ¶ added in v0.0.5
Filter2 filters (key, value) pairs based on a predicate function.
It returns a new sequence with filtered pairs.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.Count2(flow.Chain2( seq.Range2(10), flow.Filter2(func(key, _ int) bool { return key%3 == 0 }), ))) }
Output: 4
func Limit2 ¶ added in v0.0.5
Limit2 limits the number of (key, value) pairs in the sequence.
It returns a new sequence with a maximum number of pairs.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.Count2(flow.Chain2( seq.Range2(10), flow.Limit2[int, int](4), ))) }
Output: 4
func Map2 ¶ added in v0.0.9
Map2 creates a new step that applies a transformation function to each pair of elements in an input sequence.
It returns a Step2 that can be used in a pipeline to map over pairs in the input sequence.
Note:
Cannot change type.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for key, val := range flow.Chain2( seq.Range2(3), flow.Map2(func(key, val int) (int, int) { return key * 2, val * 3 }), ) { fmt.Println(key, val) } }
Output: 0 0 2 3 4 6
func Merge2 ¶ added in v0.0.5
Merge2 merges multiple sequences of (key, value) pairs.
It returns a new sequence containing all pairs.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.Count2(flow.Chain2( seq.Range2(3), flow.Merge2(seq.Range2(4), seq.Range2(2)), ))) fmt.Println(seq.Count2(flow.Chain2( seq.Range2(3), flow.Merge2[int, int](), ))) }
Output: 9 3
func Peek2 ¶ added in v0.0.5
Peek2 applies an action to each (key, value) pair in the sequence.
It returns a new sequence with the same pairs.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { seq.Emit2(flow.Chain2( seq.Range2(3), flow.Peek2(func(key, val int) { fmt.Println(key, val) }), )) }
Output: 0 0 1 1 2 2
func Prepend2 ¶ added in v0.0.8
Prepend2 creates a step that adds tuples to the beginning of a sequence.
It function is useful for creating a prepending step in a pipeline for tuples.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for key, val := range flow.Chain2( seq.Range2(2), flow.Prepend2(seq.T(7, 8)), ) { fmt.Println(key, val) } }
Output: 7 8 0 0 1 1
func Repeat2 ¶ added in v0.0.6
Repeat2 creates a new step that repeats each element of the input sequence a specified number of times.
Tt returns a `Step2` that repeats each element of the input sequence `count` times.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.Count2(flow.Chain2( seq.Range2(3), flow.Repeat2[int, int](4), ))) }
Output: 12
func Reverse2 ¶ added in v0.0.5
Reverse2 reverses the order of (key, value) pairs in the sequence.
It returns a `Step2` function that reverses the sequence.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.First2(flow.Chain2( seq.Range2(100), flow.Reverse2[int, int](), ))) }
Output: 99 99 true
func Shuffle2 ¶ added in v0.0.9
Shuffle2 creates a step that shuffles pairs in the input sequence.
It returns a Step2 that, when applied, yields pairs in a random order.
Example ¶
package main import ( "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { seq.Emit2(flow.Chain2( seq.Range2(3), flow.Shuffle2[int, int](), )) }
Output:
func Skip2 ¶ added in v0.0.5
Skip2 skips the first 'num' (key, value) pairs in the sequence.
It returns a `Skip2` with the remaining pairs.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.First2(flow.Chain2( seq.Range2(100), flow.Skip2[int, int](99), ))) }
Output: 99 99 true
func Sort2 ¶ added in v0.0.5
Sort2 sorts the (key, value) pairs in the sequence.
It returns a `Step2` function that sorts the sequence.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.First2(flow.Chain2( seq.Range2(100), flow.Reverse2[int, int](), flow.Sort2[int, int](), ))) }
Output: 0 0 true
func SortFunc2 ¶ added in v0.0.5
SortFunc2 sorts (key, value) pairs using a custom comparison function.
It returns a `Step2` function that sorts the sequence.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.First2(flow.Chain2( seq.Range2(100), flow.SortFunc2(func(num1, num2 seq.Tuple[int, int]) int { return num2.K - num1.K }), ))) }
Output: 99 99 true
func SortStableFunc2 ¶ added in v0.0.5
SortStableFunc2 sorts (key, value) pairs using a custom comparison function with stable sorting.
It returns a `Step2` function that sorts the sequence.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { fmt.Println(seq.First2(flow.Chain2( seq.Range2(100), flow.SortStableFunc2(func(num1, num2 seq.Tuple[int, int]) int { return num2.K - num1.K }), ))) }
Output: 99 99 true
func TakeWhile2 ¶ added in v0.0.8
TakeWhile2 creates a Step2[K, V] that filters key-value pairs from 'input' using 'predicate'.
It yields pairs until the predicate is false for the first time.
The returned Step2[K, V] can be used in a pipeline to process sequences of key-value pairs.
Example ¶
package main import ( "fmt" "github.com/xuender/flow" "github.com/xuender/flow/seq" ) func main() { for key, val := range flow.Chain2( seq.Range2(4), flow.TakeWhile2(func(key, _ int) bool { return key < 2 }), ) { fmt.Println(key, val) } }
Output: 0 0 1 1
Directories ¶
Path | Synopsis |
---|---|
_examples
|
|
Package seq provides functions for handling the iter.Seq interface in Go 1.23.
|
Package seq provides functions for handling the iter.Seq interface in Go 1.23. |
Package stats contains statistical functions such as Sum.
|
Package stats contains statistical functions such as Sum. |