If I have a map, how would I transform MAP-VALS
but also passing the key corresponding to the val to the function? The issue is that if I just use ALL
, it also transforms the keys, which I don't want; but if I use MAP-VALS
, then I lose the context of the key. I realize that with I can just use map
to achieve this without Specter, but then I'd have to use (into {})
to get it back to a map. I'm transforming the map a lot, so this is undesirable.
@montanonic the pattern for that is (transform [ALL (collect-one FIRST) LAST] (fn [k v] ...) data)
Ahh, nice. Thanks!