If not, I think it's pretty useful. There should be an easy way to
apply functions to maps' values by keys.
(defn update
[m & keyfuns]
(let [[key fun & rest] keyfuns]
(if (and key fun)
(recur (assoc m key (fun (key m))) rest)
m)))
(def foo {:a 5 :b 7})
(def bar (update foo :a inc :b #(+ 5 %)))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---