[Repo Assist] Add AsyncSeq.exists2, exists2Async, forall2, forall2Async#322
Draft
github-actions[bot] wants to merge 2 commits intomainfrom
Draft
[Repo Assist] Add AsyncSeq.exists2, exists2Async, forall2, forall2Async#322github-actions[bot] wants to merge 2 commits intomainfrom
github-actions[bot] wants to merge 2 commits intomainfrom
Conversation
Adds four new API functions mirroring Seq.exists2 / Seq.forall2: - AsyncSeq.exists2: tests whether any pairwise pair satisfies a synchronous predicate (short-circuits on first match) - AsyncSeq.exists2Async: async-predicate variant of exists2 - AsyncSeq.forall2: tests whether all pairwise pairs satisfy a synchronous predicate (short-circuits on first failure) - AsyncSeq.forall2Async: async-predicate variant of forall2 All four evaluate pairwise up to the shorter of the two sequences, consistent with Seq.exists2 / Seq.forall2 semantics. 12 tests added; 434/434 pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Adds four new combinators to fill F# collection API parity gaps:
AsyncSeq.exists2Seq.exists2AsyncSeq.exists2Asyncexists2AsyncSeq.forall2Seq.forall2AsyncSeq.forall2Asyncforall2Motivation
exists2andforall2are natural companions to the existingexists/forallandzip/zip3family. Developers familiar withSeq.exists2/Seq.forall2will naturally look for these in AsyncSeq.Semantics
Both functions evaluate pairwise up to the shorter of the two sequences, consistent with
Seq.exists2/Seq.forall2:exists2: returnstrueas soon as a matching pair is found; returnsfalseif no pair matchesforall2: returnsfalseas soon as a failing pair is found; returnstrueif all checked pairs pass (including the degenerate empty case)Both short-circuit —
exists2stops at the firsttrueresult,forall2stops at the firstfalse.Implementation Details
compareWithAsync) — no intermediate allocationsexists2/forall2are thin synchronous wrappers delegating to theAsyncvariants.fsisignature file updated with XML doc commentsRELEASE_NOTES.mdupdated under new4.17.0entryTest Status
✅ Build: 0 errors, 12 pre-existing warnings only
✅ Tests: 434/434 passed (12 new tests covering: match/no-match, empty sequences, short-circuit behaviour, shorter-sequence termination, and async-predicate variants for both
exists2andforall2)