Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Most `Itr` methods are **lazy transformations**, meaning they return a new `Itr`
However, some methods are **eager consumers**. These methods iterate over and consume the underlying data, returning concrete values, collections, or aggregates. Examples include:

* **Collection methods:** `collect`, `last`, `next`, `next_chunk`, `nth`, `position`
* **Aggregation methods:** `count`, `reduce`, `max`, `min`, `all`, `any`, `find`, `fold`
* **Aggregation methods:** `count`, `reduce`, `max`, `min`, `all`, `any`, `consume`, `find`, `fold`

### Important Considerations

Expand Down
19 changes: 15 additions & 4 deletions doc/apidoc.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `Itr` v0.1.5 class documentation
# `Itr` v0.1.7 class documentation
A generic iterator adaptor class inspired by Rust's Iterator trait, providing a composable API for
functional-style iteration and transformation over Python iterables.
## Public methods
Expand All @@ -23,7 +23,8 @@ Implement the next method of the Iterator protocol
### `accumulate`


Return an iterator over the accumulated results of applying the function (or sum by default) to the items.
Return an iterator over the accumulated results of applying the function (or sum by default) to the items. Does
not collapse the iterator like `reduce` or `fold`

Args:
func (Callable[[T, T], T] | None): A binary function to accumulate results. Defaults to addition.
Expand Down Expand Up @@ -104,6 +105,16 @@ Returns:



### `consume`

Exhaust the iterator. Useful when only the side effects are required (see inspect)

Do not use on an open-ended iterator

Returns:
None


### `copy`

Splits the iterator at its *current state* into two independent iterators.
Expand Down Expand Up @@ -238,11 +249,11 @@ Returns:
Itr[T]: An iterator yielding the original items after applying the function.

Example:
>>> Itr([1, 2, 3]).inspect(print).collect()
>>> Itr([1, 2, 3]).inspect(print).consume()
1
2
3
(1, 2, 3)
>>>


### `interleave`
Expand Down
Loading
Loading