Skip to content

feat: introduce Sequence type - #24

Merged
delacry merged 6 commits into
noctud:0.2.xfrom
nikophil:feature/sequence
Jul 26, 2026
Merged

feat: introduce Sequence type#24
delacry merged 6 commits into
noctud:0.2.xfrom
nikophil:feature/sequence

Conversation

@nikophil

@nikophil nikophil commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

see #23

Here is a first PR which paves the way for lazy sequences: new type is created + iteration ("re-playability" handled) + 2 intermediates (filter() and map()) and few terminals (toArray(), toList(), toSet()

I think this is enough for a first iteration, so that we can discuss on concrete code

@nikophil
nikophil marked this pull request as draft July 20, 2026 09:31
@nikophil
nikophil changed the base branch from 0.1.x to 0.2.x July 20, 2026 09:31
@nikophil nikophil changed the title feature/sequence feat: introduce Sequence type Jul 20, 2026
Comment thread src/Sequence/SequenceLogic.php
Comment thread src/Sequence/SequenceLogic.php Outdated
@nikophil
nikophil force-pushed the feature/sequence branch 2 times, most recently from 9b1e767 to fc13614 Compare July 20, 2026 09:53
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread src/Sequence/SequenceLogic.php Outdated
@nikophil
nikophil marked this pull request as ready for review July 20, 2026 10:03
Comment thread src/Sequence/SequenceLogic.php Outdated
Comment thread src/Sequence/SequenceLogic.php
Comment thread src/Sequence/SequenceLogic.php Outdated
Comment thread src/Sequence/SequenceLogic.php Outdated
Comment thread src/Sequence/SequenceLogic.php Outdated
Comment thread src/Sequence/SequenceLogic.php
nikophil added a commit to nikophil/collection that referenced this pull request Jul 26, 2026
The lastProduced guard only remembers the previous pass's iterator, so a
producer alternating between two exhausted generators bypasses it and
PHP's raw 'Cannot traverse an already closed generator' surfaces instead
of SequenceAlreadyIteratedException. Accepted limitation (catching it
would require tracking every produced iterator, i.e. unbounded memory);
requested in PR noctud#24 review.
@nikophil
nikophil requested a review from delacry July 26, 2026 14:26
nikophil added 5 commits July 26, 2026 16:26
The lastProduced guard only remembers the previous pass's iterator, so a
producer alternating between two exhausted generators bypasses it and
PHP's raw 'Cannot traverse an already closed generator' surfaces instead
of SequenceAlreadyIteratedException. Accepted limitation (catching it
would require tracking every produced iterator, i.e. unbounded memory);
requested in PR noctud#24 review.
@nikophil
nikophil requested a review from delacry July 26, 2026 17:29

@delacry delacry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this looks awesome!

@delacry
delacry merged commit 92d21e0 into noctud:0.2.x Jul 26, 2026
6 checks passed
@nikophil
nikophil deleted the feature/sequence branch July 26, 2026 18:32
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.

2 participants