Skip to content

[Repo Assist] Add AsyncSeq.transpose — mirrors Seq.transpose#273

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/add-transpose-e8323f6f8fe7f5f5
Draft

[Repo Assist] Add AsyncSeq.transpose — mirrors Seq.transpose#273
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/add-transpose-e8323f6f8fe7f5f5

Conversation

@github-actions
Copy link
Contributor

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

Summary

Adds AsyncSeq.transpose, which transposes a sequence of sequences so that the i-th element of the result is an array of the i-th elements of all inner sequences. This mirrors Seq.transpose from the F# standard library.

Behaviour

  • The entire source is buffered before any elements are yielded.
  • All inner sequences must have the same length; mismatched lengths raise ArgumentException.
  • An empty source yields an empty sequence.
  • Not available under Fable (consistent with rev, sort, etc.).

Example

let rows = asyncSeq { yield [1; 2; 3]; yield [4; 5; 6] }
let cols = AsyncSeq.transpose rows |> AsyncSeq.toArrayAsync |> Async.RunSynchronously
// cols = [| [|1;4|]; [|2;5|]; [|3;6|] |]

Changes

  • src/FSharp.Control.AsyncSeq/AsyncSeq.fs — implementation of transpose
  • src/FSharp.Control.AsyncSeq/AsyncSeq.fsi — signature declaration
  • tests/.../AsyncSeqTests.fs — 6 new tests (basic transpose, single row/column, empty, square matrix, length mismatch)
  • RELEASE_NOTES.md — entry for 4.9.0

Test Status

All 323/323 tests pass (dotnet test tests/FSharp.Control.AsyncSeq.Tests/...)

Generated by Repo Assist ·

To install this agentic workflow, run

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

Transposes a sequence of sequences: each element of the result is an
array of the i-th elements of all inner sequences. All inner sequences
must have the same length; the entire source is buffered before yielding.
Available on all targets except Fable.

Closes no specific issue; mirrors Seq.transpose.

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