You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: use while! in iter/fold/reduce/mapFold/tryLast/Drop/Truncate
Replace the manual 'go' flag + initial MoveNextAsync pre-advance pattern
with while! in iter, fold, reduce, mapFold, tryLast, and the Drop/Truncate
cases in skipOrTake.
The old pattern:
let! step = e.MoveNextAsync()
go <- step
while go do
...
let! step = e.MoveNextAsync()
go <- step
becomes:
while! e.MoveNextAsync() do
...
This matches the pattern already established by sum, sumBy, average,
averageBy, lengthBy, etc. Benefits:
- Removes one mutable bool (go) per function
- Removes the initial redundant pre-advance call before the loop
- Unifies style across the module
Also simplifies the Drop and Truncate loop bodies to use explicit
i/yielded counters instead of a pos variable with an inline if/else.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: release-notes.txt
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@ Release notes:
3
3
4
4
1.0.0
5
5
- adds taskSeqDynamic computation expression and TaskSeqDynamic/TaskSeqDynamicInfo types for dynamic (FSI-compatible) resumable code, fixing issue where taskSeq would raise NotImplementedException in F# Interactive, #246
6
+
- perf: simplify iter, fold, reduce, mapFold, tryLast, skipOrTake (Drop/Truncate) to use while! and remove manual go-flag and initial MoveNextAsync pre-advance, matching the pattern already used by sum/sumBy/average
6
7
- perf: TaskSeq.chunkBy and chunkByAsync reuse the ResizeArray buffer between chunks, reducing allocations on sequences with many chunk boundaries
7
8
- fixes: TaskSeq.insertAt, insertManyAt, removeAt, removeManyAt, updateAt now raise ArgumentNullException (not NullReferenceException) when given a null source; insertManyAt also validates the values argument
8
9
- refactor: simplify lengthBy and lengthBeforeMax to use while! and remove the redundant mutable 'go' and initial MoveNextAsync
0 commit comments