[Repo Assist] feat: add TaskSeq.scan and TaskSeq.scanAsync (ref #289)#296
Merged
[Repo Assist] feat: add TaskSeq.scan and TaskSeq.scanAsync (ref #289)#296
Conversation
Implements scan/scanAsync (issue #289 — align with AsyncSeq). scan: like fold but yields the initial state and each intermediate accumulator state. Output has N+1 elements for N-element input. scanAsync: async variant. - TaskSeqInternal.fs: scan using FolderAction DU (matches fold pattern) - TaskSeq.fsi: signatures with XML doc for scan/scanAsync - TaskSeq.fs: static member dispatch (scan/scanAsync → Internal.scan) - TaskSeq.Scan.Tests.fs: 54 tests (empty, single, multi, side-effects) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Mar 7, 2026
dsyme
approved these changes
Mar 7, 2026
Contributor
|
/repo-assist update release notes, and update AGENTS.md to make it clear the release notes need to be updated |
…equirement Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
Commit pushed:
|
dsyme
approved these changes
Mar 7, 2026
github-actions bot
pushed a commit
that referenced
this pull request
Mar 7, 2026
…289) - TaskSeq.chunkBySize: divides a task sequence into non-overlapping chunks of at most chunkSize elements. Uses a fixed-size array buffer (vs. ResizeArray) to avoid intermediate allocations and resizing. - TaskSeq.windowed: returns overlapping sliding windows of a fixed size. Uses a ring buffer internally so that only a single allocation (per window) is needed; no redundant element copies on each step. Both functions validate their size argument eagerly (before enumeration starts), raise ArgumentException for non-positive sizes, and are fully documented in the .fsi signature file. Also: - Update README.md to mark chunkBySize, windowed, pairwise, scan/scanAsync, reduce/reduceAsync, and unfold/unfoldAsync as implemented (these were merged in PRs #293, #296, #299, #300 respectively). - Update release-notes.txt for 0.5.0. - 171 new tests across TaskSeq.ChunkBySize.Tests.fs and TaskSeq.Windowed.Tests.fs. All 4021 existing tests continue to 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
TaskSeq.scanandTaskSeq.scanAsync— the "scan" analogue offold/foldAsync, which returns the sequence of intermediate accumulator states rather than just the final value.This is part of the ongoing work to align TaskSeq with
FSharp.Control.AsyncSeq(ref #289).Task 10 — Forward:
TaskSeq.scan/TaskSeq.scanAsyncWhat is
scan?Like
Seq.scan, but for async task sequences:Changes
TaskSeqInternal.fsscanfunction usingFolderActionDU (same pattern asfold)TaskSeq.fsiscanandscanAsyncsignatures with XML docTaskSeq.fsscan/scanAsyncTaskSeq.Scan.Tests.fsFSharp.Control.TaskSeq.Test.fsprojTaskSeq.Scan.Tests.fsto compile orderImplementation
The implementation is a natural generalisation of
fold: it yields the initial state, then for each element it updates the state and yields it again.Test Status
✅ Build succeeded (Release)
✅ 3598 tests passed, 2 skipped (infrastructure skips, pre-existing)
✅ Fantomas formatting check passes
✅ 54 new scan/scanAsync tests all pass