Skip to content

Commit 663a44c

Browse files
ebonnalpierrenodet
andcommitted
README: add 'running map' section
Co-authored-by: pierrenodet <[email protected]>
1 parent 58d7979 commit 663a44c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,21 @@ zeros: Stream[int] = (
175175
assert list(zeros) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
176176
```
177177

178+
### "running map"
179+
180+
> {TODO: add description}
181+
182+
```python
183+
from streamable import running
184+
185+
cumulative_sum: Stream[int] = (
186+
integers
187+
.map(running(lambda cumsum, i: cumsum + i, initial=0))
188+
)
189+
190+
assert list(cumulative_sum) == [0, 1, 3, 6, 10, 15, 21, 28, 36, 45]
191+
```
192+
178193

179194

180195
## `.foreach`

0 commit comments

Comments
 (0)