Skip to content

Commit cad8319

Browse files
committed
Fix example
1 parent 089622d commit cad8319

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,16 @@ pipelines:
168168
```python
169169
from expression.collections import seq, Seq
170170

171+
# Since static type checkes aren't good good at inferring lambda types
172+
mapper: Callable[[int], int] = lambda x: x * 10
173+
predicate: Callable[[int], bool] = lambda x: x > 100
174+
folder: Callable[[int, int], int] = lambda s, x: s + x
175+
171176
xs = Seq.of(9, 10, 11)
172177
ys = xs.pipe(
173-
seq.map(lambda x: x * 10),
174-
seq.filter(lambda x: x > 100),
175-
seq.fold(lambda s, x: s + x, 0)
178+
seq.map(mapper),
179+
seq.filter(predicate),
180+
seq.fold(folder, 0),
176181
)
177182

178183
assert ys == 110

0 commit comments

Comments
 (0)