File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff 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
120137In math, ` (f * g) (x) = f(g(x)) ` . This is called function composition.
You can’t perform that action at this time.
0 commit comments