From a4556887b45b369190d7b10f901eb6cf097c9830 Mon Sep 17 00:00:00 2001 From: Steve George Date: Sun, 25 Sep 2016 15:36:39 +0200 Subject: [PATCH] Create a 'merge' test to join maps together. (#113) --- resources/koans.clj | 1 + src/koans/06_maps.clj | 3 +++ 2 files changed, 4 insertions(+) diff --git a/resources/koans.clj b/resources/koans.clj index 6505ffe..6ae3398 100644 --- a/resources/koans.clj +++ b/resources/koans.clj @@ -79,6 +79,7 @@ false "February" 1 "January" + :c 3 2010 2014 2018 "PyeongChang" "Sochi" "Vancouver"]}] diff --git a/src/koans/06_maps.clj b/src/koans/06_maps.clj index 3466864..d4af87c 100644 --- a/src/koans/06_maps.clj +++ b/src/koans/06_maps.clj @@ -41,6 +41,9 @@ "You can also create a new version with an entry removed" (= {__ __} (dissoc {1 "January" 2 "February"} 2)) + "Create a new map by merging" + (= {:a 1 :b 2 __ __} (merge {:a 1 :b 2} {:c 3})) + "Often you will need to get the keys, but the order is undependable" (= (list __ __ __) (sort (keys { 2014 "Sochi" 2018 "PyeongChang" 2010 "Vancouver"})))