Allow nil as an answer.

This commit is contained in:
Colin Jones 2011-02-03 12:26:58 -06:00
parent 1648d9e94a
commit f29e547f2a
3 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,9 @@
(= __ ({2006 "Torino" 2010 "Vancouver" 2014 "Sochi"} 2010)) (= __ ({2006 "Torino" 2010 "Vancouver" 2014 "Sochi"} 2010))
"You may not be able to find an entry for a key" "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)) (= __ (get {:a 1 :b 2} :c :key-not-found))
"You can find out if a key is present" "You can find out if a key is present"

View File

@ -44,6 +44,7 @@
1 1
1 1
"Vancouver" "Vancouver"
nil
:key-not-found :key-not-found
true true
false false

View File

@ -3,8 +3,8 @@
(:require [clojure.set] (:require [clojure.set]
[clojure.string])) [clojure.string]))
(def __ nil) (def __ :fill-in-the-blank)
(def ___ (fn [& args] nil)) (def ___ (fn [& args] __))
(defmacro meditations [& forms] (defmacro meditations [& forms]
(let [pairs (partition 2 forms)] (let [pairs (partition 2 forms)]