MCPcopy Index your code
hub / github.com/destel/rill / ExampleFromSeq

Function ExampleFromSeq

example123_test.go:12–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10)
11
12func ExampleFromSeq() {
13 // Start with an iterator that yields numbers from 1 to 10
14 numbersSeq := slices.Values([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})
15
16 // Convert the iterator into a stream
17 numbers := rill.FromSeq(numbersSeq, nil)
18
19 // Transform each number
20 // Concurrency = 3
21 squares := rill.Map(numbers, 3, func(x int) (int, error) {
22 return square(x), nil
23 })
24
25 printStream(squares)
26}
27
28func ExampleFromSeq2() {
29 // Create an iter.Seq2 iterator that yields numbers from 1 to 10

Callers

nothing calls this directly

Calls 4

FromSeqFunction · 0.92
MapFunction · 0.92
squareFunction · 0.85
printStreamFunction · 0.85

Tested by

no test coverage detected