[Repo Assist] Add AsyncSeq.tryFindIndexBack, findIndexBack, tryFindIndexBackAsync, findIndexBackAsync#325
Draft
github-actions[bot] wants to merge 2 commits intomainfrom
Conversation
…findIndexBackAsync Completes the find-index-back family, mirroring Array.tryFindIndexBack / Array.findIndexBack. All four functions scan the full sequence and return the index of the last element satisfying the predicate. - tryFindIndexBack / tryFindIndexBackAsync: return Some index or None - findIndexBack / findIndexBackAsync: return index or raise KeyNotFoundException - 10 new tests; 444/444 passing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4 tasks
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 functions to complete the find-index-back family:
AsyncSeq.tryFindIndexBackNoneif not foundArray.tryFindIndexBackAsyncSeq.findIndexBackKeyNotFoundExceptionif not foundArray.findIndexBackAsyncSeq.tryFindIndexBackAsynctryFindIndexBackAsyncSeq.findIndexBackAsyncfindIndexBackMotivation
The API already has
tryFindBack/findBack(value-returning back-search) andtryFindIndex/findIndex(forward index search). The natural complement — searching backwards for the index of the last matching element — was missing. This fills that gap and mirrorsArray.tryFindIndexBack/Array.findIndexBack.Implementation Details
tryFindBack), maintaining a running index counter and updating the result whenever the predicate matches; returns the last recorded result at end-of-sequence.findIndexBack/findIndexBackAsyncare thin wrappers delegating to thetry*variants, raisingKeyNotFoundExceptiononNone..fsisignature file updated with XML doc comments.RELEASE_NOTES.mdupdated under the existing4.17.0entry.Test Status
✅ Build: 0 errors, pre-existing warnings only
✅ Tests: 444/444 passed (10 new tests covering: basic match, no-match returns None/raises, empty sequence, all-match returns last index, and async-predicate variants for both
tryFindIndexBackandfindIndexBack)