   (->> (for [[k v] m]
        [k (apply f v args)])
      (into {})))
+
+
+(defn map-keys
+  "Create a new map from m by calling function f on each key to get a
+  new key."
+  [m f & args]
+  (when m
+    (into {}
+          (for [[k v] m]
+            (map-entry (apply f k args) v)))))
+
+
+(defn map-vals-with-keys
+  "Create a new map from m by calling function f, with two
+  arguments (the key and value) to get a new value."
+  [m f & args]
+  (when m
+    (into {}
+          (for [[k v] m]
+            (map-entry k (apply f k v args))))))
+
+
+(defn map-keys-and-vals
+  "Create a new map from m by calling function f on each key & each
+  value to get a new key & value"
+  [m f & args]
+  (when m
+    (into {}
+          (for [[k v] m]
+            (map-entry (apply f k args) (apply f v args))))))
 
 
 (defn fix

(ns detritus.update
  "A collection of helper functions useful for updating and
  conditionally updating datastructures.")

(defn map-vals
  "λ {A → B} → (λ B → more* → C) → more* → {A → C}

  (assoc map key
         (apply f (get map key) args)))


;; Conditional update operations
;;--------------------------------------------------------------------

(defn ->when-update
  "Function of a value, a predicate, an updater and optional
