The group from the builtin library groups only consecutive items, which makes sense for use with a grouping size, but grouping with a function over all elements seems to be more useful. This is done in e.g. jq with group_by. There probably is a better name for this though
The
group
from the builtin library groups only consecutive items, which makes sense for use with a grouping size, but grouping with a function over all elements seems to be more useful. This is done in e.g.jq
withgroup_by
. There probably is a better name for this though