Eliminate .size in favor of count.
This commit is contained in:
parent
8b596c3648
commit
9b65b6d0fc
@ -3,13 +3,13 @@
|
|||||||
(= {} (hash-map))
|
(= {} (hash-map))
|
||||||
|
|
||||||
"Maps in clojure associate keys with values"
|
"Maps in clojure associate keys with values"
|
||||||
(= __ (.size (hash-map)))
|
(= __ (count (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 __))
|
||||||
|
|
||||||
"The size is the number of entries"
|
"The size is the number of entries"
|
||||||
(= __ (.size {:a 1 :b 2}))
|
(= __ (count {:a 1 :b 2}))
|
||||||
|
|
||||||
"You can look up the value for a given key"
|
"You can look up the value for a given key"
|
||||||
(= __ (get {:a 1 :b 2} :b))
|
(= __ (get {:a 1 :b 2} :b))
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
(= #{} (set nil))
|
(= #{} (set nil))
|
||||||
|
|
||||||
"They are another important data structure in clojure"
|
"They are another important data structure in clojure"
|
||||||
(= __ (.size #{}))
|
(= __ (count #{1 2 3}))
|
||||||
|
|
||||||
"Remember that a set is a 'set'"
|
"Remember that a set is a 'set'"
|
||||||
(= __ (set '(1 1 2 2 3 3 4 4 5 5)))
|
(= __ (set '(1 1 2 2 3 3 4 4 5 5)))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
(meditations
|
(meditations
|
||||||
"You can use vectors in clojure to create an 'Array' like structure"
|
"You can use vectors in clojure to create an 'Array' like structure"
|
||||||
(= __ (.size []))
|
(= __ (count [42]))
|
||||||
|
|
||||||
"You can create a vector in several ways"
|
"You can create a vector in several ways"
|
||||||
(= __ (vec nil))
|
(= __ (vec nil))
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
[:b :c :d :e]
|
[:b :c :d :e]
|
||||||
"\"No dice!\""
|
"\"No dice!\""
|
||||||
"()"]}
|
"()"]}
|
||||||
"vectors" {"__" [0
|
"vectors" {"__" [1
|
||||||
[]
|
[]
|
||||||
[1]
|
[1]
|
||||||
[nil]
|
[nil]
|
||||||
@ -31,7 +31,7 @@
|
|||||||
:jelly
|
:jelly
|
||||||
:jelly
|
:jelly
|
||||||
[:butter :and]]}
|
[:butter :and]]}
|
||||||
"sets" {"__" [0
|
"sets" {"__" [3
|
||||||
#{1 2 3 4 5}
|
#{1 2 3 4 5}
|
||||||
#{1 2 3 4 5}
|
#{1 2 3 4 5}
|
||||||
#{2 3}
|
#{2 3}
|
||||||
|
Loading…
Reference in New Issue
Block a user