Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn transform-map [map funsmap]
- (reduce (fn [m key]
- (if (contains? m key)
- (assoc m key ((get funsmap key) (get map key)))
- m))
- map (keys funsmap)))
- (transform-map {:x 1 :y 2}
- {:x #(* 20 %) :z #(* 10 %)})
- gives
- {:x 20, :y 2}
Add Comment
Please, Sign In to add comment