Skip to content

Commit

Permalink
docs: documentation for eager iters (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBernstorff authored Mar 9, 2024
2 parents ec6c71c + 108d3b5 commit 7f45065
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@ result = (Iter([1, 2])
assert result == [4]
```

### Lazy vs eager evaluation
Inspired by Polars, iterpy supports eager evaluation for easier debugging using `Arr`, and lazy evaluation for better performance using `Iter`. To access eager evaluation:

```python
from iterpy import Arr

result = Arr([1, 2, 3]).map(lambda x: x * 2).to_list()
assert result == [2, 4, 6]
```

To access lazy evaluation, just rename `Arr` to `Iter`:

```python
from iterpy import Iter

result = Iter([1, 2, 3]).map(lambda x: x * 2).to_list()
assert result == [2, 4, 6]
```

## Prior art
iterpy stands on the shoulders of Scala, Rust etc.

Expand Down

0 comments on commit 7f45065

Please sign in to comment.