From e6451ba33ba91d095256523b0059baab7cf02235 Mon Sep 17 00:00:00 2001 From: "Erick G. Islas-Osuna" Date: Sun, 12 Jun 2022 14:24:13 -0500 Subject: [PATCH] update readme examples --- README.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 91741f5..6e8e88e 100644 --- a/README.md +++ b/README.md @@ -18,17 +18,7 @@ Consider these examples: :b [{:dd 4}]}) ;; Manual Clojure -(defn map-vals [m afn] - (->> m (map (fn [[k v]] [k (afn v)])) (into (empty m)))) - -(map-vals data - (fn [v] - (mapv - (fn [m] - (map-vals - m - (fn [v] (if (even? v) (inc v) v)))) - v))) +(update-vals data (fn [vals] (map #(update-vals % inc) vals))) ;; Specter (transform [MAP-VALS ALL MAP-VALS even?] inc data) @@ -40,7 +30,7 @@ Consider these examples: (def data {:a [1 2 3]}) ;; Manual Clojure -(update data :a (fn [v] (into (if v v []) [4 5]))) +(update data :a concat [4 5]) ;; Specter (setval [:a END] [4 5] data)