Guest User

Untitled

a guest
Aug 18th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. (defn transform-map [map funsmap]
  2. (reduce (fn [m key]
  3. (if (contains? m key)
  4. (assoc m key ((get funsmap key) (get map key)))
  5. m))
  6. map (keys funsmap)))
  7.  
  8. (transform-map {:x 1 :y 2}
  9. {:x #(* 20 %) :z #(* 10 %)})
  10. gives
  11. {:x 20, :y 2}
Add Comment
Please, Sign In to add comment