Open sprmnt21 opened 2 years ago
So the "local" semantic here is to break up "runs"?
I think there is definitely a space for this. There is an operation that generally goes by the name partition
which generally behaves like group
but the groups are assumed to be contiguous. It should be possible to somehow pass in the "previous group key" or something like that into a comparison function.
It's worth considering what the semantics of the keys are for dictionaries and other iterable data structures (the r
part).
Another idea - you could just return an array of (sub?) arrays, for example,
I would like to ask if the opportunity to have a version of the group function with an additional parameter such as the comparison of the innerjoin function has ever been considered. This possibility / flexibility could be very useful on many occasions. Just to make the idea better (certainly not because he has the audacity to suggest how to possibly develop the thing) I submit a naive version of the function and some application examples. The name, following the lines of the functions groupsum, groupprod, etc. is grouplocal, because groups are made "locally" and not globally.
leading group UPPERCASE
alternate sequences of odd even numbers
difference between contiguous values greater than 2 as separation threshold
leading group has the same first 4 characters