Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
p9f authored Oct 1, 2024
1 parent 1cc2e06 commit 54f89cf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,30 @@ pip install iter-pipes

### Examples

#### pipe:

```python
from collections.abc import Iterable

from iter_pipes import PipelineFactory


def process_a(items: Iterable[int]):
for item in items:
yield item * 2 + 1


def process_b(items: Iterable[int]):
for item in items:
yield item
yield -item


pipeline = PipelineFactory[int]().pipe(process_a).pipe(process_b)

assert pipeline(range(3)).to_list() == [1, -1, 3, -3, 5, -5]
```

#### map / filter:

```python
Expand Down

0 comments on commit 54f89cf

Please sign in to comment.