fix update only evens

This commit is contained in:
Erick G. Islas-Osuna 2022-06-12 14:31:48 -05:00
parent e6451ba33b
commit 0c20d12b90
No known key found for this signature in database
GPG key ID: 95CD2097762D4C86

View file

@ -18,7 +18,8 @@ Consider these examples:
:b [{:dd 4}]})
;; Manual Clojure
(update-vals data (fn [vals] (map #(update-vals % inc) vals)))
(let [update-even #(update-vals % (fn [v] (cond-> v (even? v) inc)))]
(update-vals data #(mapv update-even %)))
;; Specter
(transform [MAP-VALS ALL MAP-VALS even?] inc data)