(defn map-in "Returns a lazy sequence consisting of the results of calling map on coll, for each value in the coll, extracting the value using keys ks, finally applying f the that value and args: (apply f item args)" [coll [& ks] f & args] (map (fn [item] (let [value (reduce #(%2 %1) item ks)] (apply f value args))) coll))
(def customers [{:name "Alice" :address {:city "Raleigh" :state "NC"}} {:name "Bob" :address {:city "Seattle" :state "WA"}}])
(map-in customers [:address :state] #(-> % clojure.string/lower-case keyword))=> (:nc :wa)
(defn map-in [coll ks f & args]
(->> coll
(map #(get-in % ks))
(map #(apply f % args))))
(defn map-in [coll ks f & args]
(map #(apply f (get-in % ks) args) coll))