Skip to content

[Repo Assist] Add C# extension methods for WindowWhile, ChunkWhile, PairwiseWith, MapRows, MapCols#666

Merged
dsyme merged 3 commits intomasterfrom
repo-assist/fix-issue-207-csharp-windowing-cleanup-ef1b9bc0d09550f9
Mar 19, 2026
Merged

[Repo Assist] Add C# extension methods for WindowWhile, ChunkWhile, PairwiseWith, MapRows, MapCols#666
dsyme merged 3 commits intomasterfrom
repo-assist/fix-issue-207-csharp-windowing-cleanup-ef1b9bc0d09550f9

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Repo Assist — automated PR in response to @dsyme's request on #207.

Closes #207

Summary

Implements the C# API cleanup requested in #207. Adds the missing C# extension methods so that the windowing, chunking, and pairwise operations exposed in the F# Series module are also accessible from C#.

New extensions

SeriesExtensions

Method Description
WindowWhile(Func(K,K,bool)) Sliding windows: one window per key, growing while condition holds
WindowWhileInto(Func(K,K,bool), Func(Series<K,V),U>) Same, with aggregation
ChunkWhile(Func(K,K,bool)) Non-overlapping chunks, split when condition fails
ChunkWhileInto(Func(K,K,bool), Func(Series<K,V),U>) Same, with aggregation
PairwiseWith(Func(K,T,T,U)) Apply function to each consecutive pair of values

FrameExtensions

Method Description
MapRows(Func(R, ObjectSeries<C), V>) Map each row to a value → Series(R,V)
MapCols(Func(C, ObjectSeries<R), ObjectSeries(R)>) Transform each column → Frame(R,C)

All methods are thin wrappers delegating to the existing F# Series.* / Frame.* functions.

Design notes

  • Distance-based windowing (windowDist/chunkDist) is intentionally omitted from the C# API: those F# functions use SRTP arithmetic constraints that cannot be expressed in non-inline F# or C# code. Users can achieve the same result with WindowWhile/ChunkWhile and a subtraction condition in the lambda.
  • PairwiseWith takes Func(K, T, T, U) (key + two values) rather than Func(K, Tuple<T,T), U>, which is more idiomatic for C# callers.

Test status

  • dotnet test tests/Deedle.CSharp.Tests/29/29 passed (5 new tests added)
  • dotnet test tests/Deedle.Tests/676/676 passed
  • dotnet build src/Deedle/Deedle.fsproj -c Release0 errors, 0 new warnings

Generated by Repo Assist for issue #207 ·

To install this agentic workflow, run

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

…apRows, MapCols

Closes #207

Adds the following C# extension methods that were missing from the public API:

SeriesExtensions:
- WindowWhile(cond) - sliding windows based on a key condition
- WindowWhileInto(cond, reduce) - sliding windows with aggregation
- ChunkWhile(cond) - non-overlapping chunks based on a key condition
- ChunkWhileInto(cond, reduce) - non-overlapping chunks with aggregation
- PairwiseWith(f) - apply a function to each consecutive pair of values

FrameExtensions:
- MapRows(f) - map each row to a value, returning Series<R,V>
- MapCols(f) - transform each column, returning a new Frame<R,C>

All new methods delegate to the existing F# Series/Frame module functions.
Tests added to Deedle.CSharp.Tests.

Co-authored-by: Copilot <[email protected]>
@dsyme dsyme marked this pull request as ready for review March 19, 2026 10:19
@dsyme dsyme merged commit c4e2173 into master Mar 19, 2026
2 checks passed
@dsyme dsyme deleted the repo-assist/fix-issue-207-csharp-windowing-cleanup-ef1b9bc0d09550f9 branch March 19, 2026 10:19
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.

Sync & clean up the C# extension method API

1 participant