From nested values to sequences

Not 100% certain what you want because the provided desired data structure is not valid (map forms with an uneven amount of items). But maybe this?

(let [data {"k1" {"email" "oad", "env" "prod" "inf" "eth0"}
            "k2" {"email" "cmi", "env" "prod" "inf" "eth0"}
            "k3" {"email" "oad", "env" "prod" "inf" "eth0"}
            "k4" {"email" "oad", "env" "prod" "inf" "eth0"}
            "k5" {"email" "cmi", "env" "prod" "inf" "eth0"}}
      ks ["email" "env" "inf"]]
  (into {}
        (map (fn [[k mv]]
               [(into #{} (map #(keyword (mv %))) ks)
                k]))
        data))
=> {#{:prod :eth0 :oad} "k4", #{:prod :eth0 :cmi} "k5"}
2 Likes