update readme examples
This commit is contained in:
parent
67e8680602
commit
e6451ba33b
1 changed files with 2 additions and 12 deletions
14
README.md
14
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue