File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -135,9 +135,9 @@ Here some example of how to use Streams:
135135Stream.randint(1 , 100 ).limit(100 ).toList()
136136```
137137
138- * Generate a list of the numbers from 1 to 100
138+ * Print the numbers from 1 to 100
139139``` py
140- Stream.iterate(1 , lambda i : i + 1 ).limit(100 ).toList( )
140+ Stream.iterate(1 , lambda i : i + 1 ).limit(100 ).forEach( print )
141141```
142142
143143* Generate a list of squares of the number from 1 to 100
@@ -150,6 +150,16 @@ Stream.iterate(1, lambda i: i + 1).map(lambda x: x**2).limit(100).toList()
150150Stream.generate(lambda : 0 ).limit(100 ).toList()
151151```
152152
153+ * Generate a set of the first 100 odds number
154+ ``` py
155+ Stream.odds().limit(100 ).toSet()
156+ ```
157+
158+ * Generate a list of all the primes number smaller than 100
159+ ``` py
160+ Stream.primes().filter(lambda x : x < 100 ).toList()
161+ ```
162+
153163
154164
155165<!-- ROADMAP -->
You can’t perform that action at this time.
0 commit comments