specter

Latest version: 1.1.3
montanonic 2018-06-03T04:35:47.000072Z

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.

nathanmarz 2018-06-03T04:50:45.000038Z

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

👍 1
montanonic 2018-06-03T04:51:40.000023Z

Ahh, nice. Thanks!