Fork me on GitHub
#specter
<
2018-06-03
>
montanonic04:06:47

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.

nathanmarz04:06:45

@montanonic the pattern for that is (transform [ALL (collect-one FIRST) LAST] (fn [k v] ...) data)

šŸ‘ 4
montanonic04:06:40

Ahh, nice. Thanks!