From e5542aa892df1b16a4135bc1a592b6aa36a61ebf Mon Sep 17 00:00:00 2001 From: Jonathan Chen Date: Fri, 24 Aug 2018 14:27:11 -0700 Subject: [PATCH 1/3] Docs: Update deepmerge info Old link was broken --- 02_composite-data/2-23_combining-maps.asciidoc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/02_composite-data/2-23_combining-maps.asciidoc b/02_composite-data/2-23_combining-maps.asciidoc index a9a5e5ae..7abeddc8 100644 --- a/02_composite-data/2-23_combining-maps.asciidoc +++ b/02_composite-data/2-23_combining-maps.asciidoc @@ -81,8 +81,15 @@ function. [source,clojure] ---- -;; Copied verbatim from the defunct clojure-contrib (http://bit.ly/deep-merge-with) -(defn deep-merge-with [f & maps] +;; Copied verbatim from the defunct [clojure-contrib](https://crossclj.info/ns/org.clojure/clojure-contrib/1.2.0/clojure.contrib.map-utils.html#_deep-merge-with) +(defn deep-merge-with + "Like merge-with, but merges maps recursively, applying the given fn + only when there's a non-map at a particular level. + + (deepmerge + {:a {:b {:c 1 :d {:x 1 :y 2}} :e 3} :f 4} + {:a {:b {:c 2 :d {:z 9} :z 3} :e 100}}) + -> {:a {:b {:z 3, :c 3, :d {:z 9, :x 1, :y 2}}, :e 103}, :f 4}" + [f & maps] (apply (fn m [& maps] (if (every? map? maps) From 6534711b3a71391b891c2b484ee925f7b4790d53 Mon Sep 17 00:00:00 2001 From: Jonathan Chen Date: Fri, 24 Aug 2018 14:29:44 -0700 Subject: [PATCH 2/3] Docs: Update docstring example --- 02_composite-data/2-23_combining-maps.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/02_composite-data/2-23_combining-maps.asciidoc b/02_composite-data/2-23_combining-maps.asciidoc index 7abeddc8..00a3f91d 100644 --- a/02_composite-data/2-23_combining-maps.asciidoc +++ b/02_composite-data/2-23_combining-maps.asciidoc @@ -86,8 +86,8 @@ function. "Like merge-with, but merges maps recursively, applying the given fn only when there's a non-map at a particular level. - (deepmerge + {:a {:b {:c 1 :d {:x 1 :y 2}} :e 3} :f 4} - {:a {:b {:c 2 :d {:z 9} :z 3} :e 100}}) + (deep-merge-with + {:a {:b {:c 1 :d {:x 1 :y 2}} :e 3} :f 4} + {:a {:b {:c 2 :d {:z 9} :z 3} :e 100}}) -> {:a {:b {:z 3, :c 3, :d {:z 9, :x 1, :y 2}}, :e 103}, :f 4}" [f & maps] (apply From 584bd4b8630057c5c0a2162b7beab65e5ded1a2a Mon Sep 17 00:00:00 2001 From: Jonathan Chen Date: Fri, 24 Aug 2018 15:04:04 -0700 Subject: [PATCH 3/3] Docs: Update link --- 02_composite-data/2-23_combining-maps.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02_composite-data/2-23_combining-maps.asciidoc b/02_composite-data/2-23_combining-maps.asciidoc index 00a3f91d..011ea4cd 100644 --- a/02_composite-data/2-23_combining-maps.asciidoc +++ b/02_composite-data/2-23_combining-maps.asciidoc @@ -81,7 +81,7 @@ function. [source,clojure] ---- -;; Copied verbatim from the defunct [clojure-contrib](https://crossclj.info/ns/org.clojure/clojure-contrib/1.2.0/clojure.contrib.map-utils.html#_deep-merge-with) +;; Copied verbatim from the defunct [clojure-contrib](https://clojure.github.io/clojure-contrib/map-utils-api.html#clojure.contrib.map-utils/deep-merge-with) (defn deep-merge-with "Like merge-with, but merges maps recursively, applying the given fn only when there's a non-map at a particular level.