Closed hlship closed 5 years ago
Would love to see this added as well. 👍
Me too. A better name for it is maybe index-by
which I've seen in a couple of other places.
Can index-by be made more generic to accept a collision handling function? This will provide more flexibility in the strategies to be used for handling same keys!
I don't think index-by
should be made mode complex. Currently there's a nice similarity between group-by
, which adds values to a vector, and index-by
, which overwrites values.
If we want a function that handles collisions, I think it should be separate, because its functionality would be a superset of the functionality in index-by
and group-by
. I'm also not sure how useful such a function would be.
I end up copy-and-pasting this function into a lot of my projects, so this feels like a good home for it.