-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Description
Wondering if you'd be open to a function index-and-map-by generalizing over index-by like the following:
(defn index-and-map-by
[kf vf coll]
(into {}
(map
(fn [x]
[(kf x) (vf x)]))
coll))(Of course, you might want to improve the peformance of this implementation, e.g with reduce and transients).
(index-and-map-by kf vf coll) would be equivalent to (->> coll (index-by kf) (map-vals vf))
I'm asking because I keep defining this index-and-map-by function in my projects.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels