Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn map-map [from-map func] (reduce merge (for [[key value] from-map] (hash-map key (func value)))))
- (map-map {:a 2 :b 4} #(* 3 %))
- ;; other possible solutions:
- (defn map-map [f m]
- (into (empty m) (map (fn [[k v]] [k (f v)]) m)))
- (let [m {:a 2 :b 4}]
- (merge-with * m (zipmap (keys m) (repeat 3))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement