specter

Latest version: 1.1.3
lxsli 2018-11-08T15:00:07.037800Z

Hi, I have this:

(transform [ALL] (fn [[k v]] [k (transform [ALL] (fn [[k1 v1]] [k1 (resolver-key k k1)]) v)]) rs))
With rs like:
{:Entry {:foo _ :bar _} ...}
I get my result:
{:Entry {:foo :Entry-foo :bar :Entry-bar} ...}

lxsli 2018-11-08T15:00:59.038800Z

It feels like if there was a way to use MAP-VALS but collect the key as I did so, that would be easier?

nathanmarz 2018-11-08T15:04:52.039300Z

@lxsi you want to use value collection for this:

(def MAP-VALS-WITH-KEY (path ALL (collect-one FIRST) LAST))
(transform [MAP-VALS-WITH-KEY MAP-VALS-WITH-KEY] (fn [k1 k2 _] (resolver-key k1 k2)) data)

lxsli 2018-11-08T15:05:22.039500Z

Sweet, thank you!