Skip to content

[Repo Assist] Add AsyncSeq.tryFindIndexBack, findIndexBack, tryFindIndexBackAsync, findIndexBackAsync#325

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/improve-findIndexBack-20260505-0babe087728a3488
Draft

[Repo Assist] Add AsyncSeq.tryFindIndexBack, findIndexBack, tryFindIndexBackAsync, findIndexBackAsync#325
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/improve-findIndexBack-20260505-0babe087728a3488

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 5, 2026

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Adds four new functions to complete the find-index-back family:

Function Description Mirrors
AsyncSeq.tryFindIndexBack Index of the last element satisfying a synchronous predicate; returns None if not found Array.tryFindIndexBack
AsyncSeq.findIndexBack Index of the last element satisfying a synchronous predicate; raises KeyNotFoundException if not found Array.findIndexBack
AsyncSeq.tryFindIndexBackAsync Async-predicate variant of tryFindIndexBack
AsyncSeq.findIndexBackAsync Async-predicate variant of findIndexBack

Motivation

The API already has tryFindBack / findBack (value-returning back-search) and tryFindIndex / findIndex (forward index search). The natural complement — searching backwards for the index of the last matching element — was missing. This fills that gap and mirrors Array.tryFindIndexBack / Array.findIndexBack.

Implementation Details

  • Scans the full sequence (same pattern as tryFindBack), maintaining a running index counter and updating the result whenever the predicate matches; returns the last recorded result at end-of-sequence.
  • findIndexBack / findIndexBackAsync are thin wrappers delegating to the try* variants, raising KeyNotFoundException on None.
  • .fsi signature file updated with XML doc comments.
  • RELEASE_NOTES.md updated under the existing 4.17.0 entry.

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 tryFindIndexBack and findIndexBack)

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@96b9d4c39aa22359c0b38265927eadb31dcf4e2a

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants