I have a list of timestamps, and want to group them together if they are less than a certain duration apart (map them to the durations they represent, so I can sum the durations to get the total amount of time). I feel like there is a stdlib function on List to do this, but I can’t find it.
e
ephemient
08/12/2022, 5:36 AM
stdlib `groupBy`/`groupingBy` makes sense for equivalence classes where you can define a key. it doesn't sound like that's the case here, so there isn't really anything in stdlib to help
I'm sure it feels that way right now since you need it, but it's pretty simple to write yourself and there's myriad missing functions for all kinds of operations other people want but you've never needed.
e
ephemient
08/12/2022, 8:52 PM
I think it's reasonably common - I've written it at least 3 times now, and it's in other langauges' standard libraries