[Repo Assist] feat: add exists, forall, choose to LazyList module#253
Conversation
LazyList was missing three common collection functions that are present in FSharp.Collections.List and Seq: - exists: returns true if any element satisfies the predicate (short-circuits) - forall: returns true if all elements satisfy the predicate (short-circuits) - choose: applies an option-returning function; lazily yields Some values exists and forall are strict (traverse the list up to the first match/mismatch). choose follows the same lazy evaluation pattern as filter: evaluation is deferred until the returned list is consumed. Both LazyList.fs and LazyList.fsi updated; 9 new tests added, all passing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds the missing exists, forall, and choose functions to the LazyList module to better align FSharpx.Collections with standard F# collection APIs (per #152), including public signatures and tests.
Changes:
- Added
LazyList.existsandLazyList.forallwith short-circuiting traversal semantics. - Added
LazyList.choose, producing a lazily-evaluated filtered/mappedLazyList. - Added unit tests for the new APIs (finite/empty cases plus a basic laziness scenario for
choose).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/FSharpx.Collections.Tests/LazyListTests.fs | Adds new tests for exists, forall, and choose |
| src/FSharpx.Collections/LazyList.fsi | Exposes new LazyList public signatures with XML docs |
| src/FSharpx.Collections/LazyList.fs | Implements exists, forall, and choose |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot Resolve merge conflicts |
…forall/choose tests with rev/concat/split/drop/unfold tests Co-authored-by: gdziadkiewicz <8547855+gdziadkiewicz@users.noreply.github.com>
Merge conflicts resolved in commit |
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.