Skip to content

[Repo Assist] Add AsyncSeq.findIndex, tryFindIndex, findIndexAsync, tryFindIndexAsync, sortWith#261

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/improve-findindex-sortwith-4972099a03844b3c
Draft

[Repo Assist] Add AsyncSeq.findIndex, tryFindIndex, findIndexAsync, tryFindIndexAsync, sortWith#261
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/improve-findindex-sortwith-4972099a03844b3c

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Mar 1, 2026

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

Summary

Adds five new combinators to AsyncSeq, filling gaps relative to the standard Seq module:

Function Description Mirrors
findIndex Returns 0-based index of first element satisfying predicate; raises KeyNotFoundException if not found Seq.findIndex
tryFindIndex Returns Some index of first matching element, or None Seq.tryFindIndex
findIndexAsync Async-predicate variant of findIndex; raises KeyNotFoundException if not found
tryFindIndexAsync Async-predicate variant of tryFindIndex; returns option
sortWith Sorts sequence using a custom comparison function, returning an array Seq.sortWith

Implementation Notes

  • tryFindIndex/tryFindIndexAsync are implemented with direct use ie = source.GetEnumerator() loops (same pattern as tryItem) to avoid a forward-reference to indexed.
  • sortWith reuses the existing toSortedSeq helper used by sort, sortBy, etc.
  • Return type for findIndex/tryFindIndex is int (matching Seq.findIndex) not int64.

Test Status

Build: ✅ succeeded (0 errors, 1 pre-existing warning on groupByAsync)
Tests: ✅ 279/279 passed (267 before + 12 new)

Closes #none (standalone improvement)

Generated by Repo Assist

To install this agentic workflow, run

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

…nc, sortWith

Five new combinators mirroring standard F# module functions:
- findIndex: returns 0-based index of first matching element; raises KeyNotFoundException if not found (mirrors Seq.findIndex)
- tryFindIndex: returns Some index for first matching element, or None (mirrors Seq.tryFindIndex)
- findIndexAsync: async-predicate variant of findIndex; raises KeyNotFoundException if not found
- tryFindIndexAsync: async-predicate variant of tryFindIndex; returns option
- sortWith: sorts sequence using custom comparison function, returning array (mirrors Seq.sortWith)

12 new tests added; 279 total pass.

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