-
-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Firstly, I'm really not sure about the name suggestion here...
These methods would be the equivalent of doing .Lag(2).Skip(2) and having the lagged value not be nullable.
So one could do:
List<int> values = [1, 3, 5, 7];
foreach((int value, int laggedValue) in values.LagMatch(1))
{
// Would give (3, 1), (5, 3), (7, 5)
}This would be the equivalent of:
List<int> values = [1, 3, 5, 7];
foreach((int value, int? laggedValue) in values.Lag(1).Skip(1))
{
// Would give (3, 1), (5, 3), (7, 5)
}But without having to worry about sending the same argument to both methods, and dealing with the nullable laggedValue
LeadMatch() would be the same, but would add SkipLast()
If you think that this would be a good idea, I'm happy to look at the implementation of it myself. Naming suggestions welcome!
Metadata
Metadata
Assignees
Labels
No labels