-
Notifications
You must be signed in to change notification settings
8000
- Fork 420
Lead, Lag & Window behavior are incoherent #632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Lead
, Lag
and Window
behavior are not coherant.Lead
, Lag
and Window
behavior are not coherant.
Lead
, Lag
and Window
behavior are not coherant.Lead
, Lag
and Window
behavior are not coherant.
An other option is to made
This is a breaking change for current |
Please expand. You didn't say why apart from that the 3 differ in behaviour and that two require defaults. Each has arguments that pertain to its function. |
Lead
, Lag
and Window
behavior are not coherant.
For readability, I use the not yet merged Current behavior is: var nums = new[] {1,2,3 };
nums.Lag(1); // [1,0],[2,1],[3,2]
nums.Lead(1); // [1,2],[2,3],[3,0]
nums.Window(2); // [1,2],[2,3]
nums.WindowLeft(2); // [1,2],[2,3],[3]
nums.WindowRight(2); // [1],[1,2],[2,3] All of this methods are providing pairs of neighbour elements from the original
What is missing is:
And my expected behavior is: var nums = new[] {1,2,3 };
nums.Lag(1); // [2,1],[3,2]
nums.Lead(1); // [1,2],[2,3]
nums.Window(2); // [1,2],[2,3] Then add overloads for other needs: var nums = new[] {1,2,3 };
nums.Lag(1, paddingValue: 0); // [1,0],[2,1],[3,2]
nums.Lead(1, paddingValue: 0); // [1,2],[2,3],[3,0]
nums.Window(2, paddingValue: 0); // [0,1],[1,2],[2,3],[3,0]
|
Lead
andLag
return a default value when looking before or after the source sequence.Window
stays in the source sequence.The difference of behavior is misleading.
We may think to homogenize this and have this grammar:
This is a breaking change for current
Lead
andLag
behavior.The text was updated successfully, but these errors were encountered: