streams
This commit is contained in:
parent
e9cf83145f
commit
3386de9894
7 changed files with 143 additions and 1 deletions
21
main.py
Executable file
21
main.py
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
|
||||
from math import log2
|
||||
from qas_flow import Stream
|
||||
|
||||
|
||||
def gen():
|
||||
n = 0
|
||||
while True:
|
||||
yield n
|
||||
n += 1
|
||||
|
||||
|
||||
def mapfunc(ix):
|
||||
i, x = ix
|
||||
return str(x) * int(log2(i + 1))
|
||||
|
||||
|
||||
strm = Stream(gen())
|
||||
print(strm.enumerate().map(mapfunc).skip(20).take(4).enumerate().collect())
|
||||
Loading…
Add table
Add a link
Reference in a new issue