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