From f29e547f2a1f96bd2f351fa749a622dd41d91ee3 Mon Sep 17 00:00:00 2001 From: Colin Jones Date: Thu, 3 Feb 2011 12:26:58 -0600 Subject: [PATCH] Allow nil as an answer. --- src/koans/maps.clj | 3 +++ src/path_to_answer_sheet.clj | 1 + src/path_to_enlightenment.clj | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/koans/maps.clj b/src/koans/maps.clj index 205c022..bbaeeab 100644 --- a/src/koans/maps.clj +++ b/src/koans/maps.clj @@ -24,6 +24,9 @@ (= __ ({2006 "Torino" 2010 "Vancouver" 2014 "Sochi"} 2010)) "You may not be able to find an entry for a key" + (= __ (get {:a 1 :b 2} :c)) + + "But you can provide your own default" (= __ (get {:a 1 :b 2} :c :key-not-found)) "You can find out if a key is present" diff --git a/src/path_to_answer_sheet.clj b/src/path_to_answer_sheet.clj index 40f6632..63844ad 100644 --- a/src/path_to_answer_sheet.clj +++ b/src/path_to_answer_sheet.clj @@ -44,6 +44,7 @@ 1 1 "Vancouver" + nil :key-not-found true false diff --git a/src/path_to_enlightenment.clj b/src/path_to_enlightenment.clj index a65f9ed..9941bae 100644 --- a/src/path_to_enlightenment.clj +++ b/src/path_to_enlightenment.clj @@ -3,8 +3,8 @@ (:require [clojure.set] [clojure.string])) -(def __ nil) -(def ___ (fn [& args] nil)) +(def __ :fill-in-the-blank) +(def ___ (fn [& args] __)) (defmacro meditations [& forms] (let [pairs (partition 2 forms)]