Skip to content

feat: add Seq.take_while - #278

Merged
dbrattli merged 2 commits into
dbrattli:mainfrom
ChrisJr404:feat/seq-take-while
Sep 6, 2026
Merged

feat: add Seq.take_while#278
dbrattli merged 2 commits into
dbrattli:mainfrom
ChrisJr404:feat/seq-take-while

Conversation

@ChrisJr404

Copy link
Copy Markdown
Contributor

Picks up one more function from #82. take_while yields elements while the predicate holds and then skips the rest, matching F# Seq.takeWhile.

It follows the existing take/skip style, a @curry_flip(1) module function plus a fluent Seq.take_while method, both lazy so they work on infinite sequences.

Tests cover the functional and fluent APIs (property based against itertools.takewhile), stopping on the first false element, and laziness on seq.infinite.

Verified with uv run pytest, ruff check, ruff format --check, and pyright.

@dbrattli dbrattli left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for adding

@dbrattli
dbrattli merged commit d1dcb0e into dbrattli:main Sep 6, 2026
6 checks passed
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