Skip to content

Non-empty versions of Itertools::chunk_by#41

Open
ronnodas wants to merge 2 commits into
olson-sean-k:masterfrom
ronnodas:iter-chunks
Open

Non-empty versions of Itertools::chunk_by#41
ronnodas wants to merge 2 commits into
olson-sean-k:masterfrom
ronnodas:iter-chunks

Conversation

@ronnodas

Copy link
Copy Markdown
Contributor

The groups yielded by Itertools::chunk_by are always non-empty. Further, if the input iterator is non-empty, then it yields at least one group.

Since the ChunkBy only implements IntoIterator, I used two wrapper structs to pass through the indirections. For similar reasons, Iterator1::chunk_by1() returns NonEmpty<ChunkBy>.

Are there default methods Groups1 should implement? Should the construction of the NonEmpty in Iterator1::chunk_by1() have safety comments?

@ronnodas ronnodas changed the title Iter chunks Non-empty versions of Itertools::chunk_by Apr 1, 2026
@ronnodas

ronnodas commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

Is it better to name the methods chunk1_by?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant