Fork me on GitHub
#clojure-dev
<
2016-06-29
>
jonas14:06:58

One helper function I’ve needed many times is one I usually call index-by. Similar to group-by but with single values (and not a vector of values as in group-by). Usually I either throw on duplicate values or just let it have last-value-per-key-wins semantics. Is this (or similar) function something that could potentially get into clojure.core? Has it been discussed before?

jonas14:06:34

@alexmiller: Looks kind of similar, but not exactly the same as my common use case

Alex Miller (Clojure team)14:06:55

you’re welcome to submit an enhancement but needs a lot more motivation and detail to make a strong case

jonas14:06:39

I don’t think I can motivate it enough, but it came up again today.. so I just wanted to ask if others have needed this fn as well and wished it was in core 🙂

jonas14:06:15

but it’s not a problem to have a local helper function for it either

seancorfield15:06:53

@jonas: Yeah, we use that all over the place but we called it resultset->lookup because we always use it with java.jdbc stuff.

seancorfield15:06:08

(It assumes last value wins in our version)