changed the order of some exercises and removed a confusing map entry

Signed-off-by: Colin Jones <trptcolin@gmail.com>
This commit is contained in:
Nuno Marques 2010-09-30 14:14:07 +02:00 committed by Colin Jones
parent 9b36862ab0
commit 1d09a984e7

View File

@ -1,10 +1,10 @@
(meditations (meditations
"Maps in clojure associate keys with values"
(= __ (.size (hash-map)))
"There are two ways to create maps" "There are two ways to create maps"
(= {} (hash-map)) (= {} (hash-map))
"Maps in clojure associate keys with values"
(= __ (.size (hash-map)))
"A value must be supplied for each key" "A value must be supplied for each key"
(= {:a 1} (hash-map :a __)) (= {:a 1} (hash-map :a __))
@ -33,7 +33,7 @@
(= __ (contains? {:a nil :b nil} :c)) (= __ (contains? {:a nil :b nil} :c))
"Maps are immutable, but you can create a new, 'changed' version" "Maps are immutable, but you can create a new, 'changed' version"
(= {1 "January" 2 __} (assoc {1 "January" 2 "Febuary"} 2 "February")) (= {1 "January" 2 __} (assoc {1 "January" } 2 "February"))
"You can also 'remove' an entry" "You can also 'remove' an entry"
(= {__ __} (dissoc {1 "January" 2 "February"} 2)) (= {__ __} (dissoc {1 "January" 2 "February"} 2))