Skip to content

Commit f654fc7

Browse files
author
czheo
committed
2 parents 13b144d + d387cb4 commit f654fc7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,23 @@ def push(lst, x):
115115
# returns [1,2,3]
116116
```
117117

118+
### lazy pipe
119+
120+
Because our `pipe` is quite hard working, it doesn't work well with the lazy `/to/` function.
121+
122+
`lazy_pipe` works in a "one-by-one" manner. It puts only 1 item into the pipe at each time.
123+
124+
``` python
125+
lazy_pipe(1 /to/ INF) | print | when(lambda x: x < 10)
126+
# this prints 1 to 9
127+
128+
lazy_pipe(input) | print | when(lambda x: x != "")
129+
# lazy_pipe also accepts a function as input. The function is called each time as long as the `when` condition holds.
130+
# this echos anything you input
131+
```
132+
133+
TODO: support multiprocessing with lazy pipe
134+
118135
### composable function
119136

120137
In math, `(f * g) (x) = f(g(x))`. This is called function composition.

0 commit comments

Comments
 (0)