standardizing indentation
This commit is contained in:
parent
2cf40290b9
commit
927212f253
@ -1,9 +1,9 @@
|
||||
(meditations
|
||||
"We shall contemplate truth by testing reality, via equality."
|
||||
(= __ true)
|
||||
"We shall contemplate truth by testing reality, via equality."
|
||||
(= __ true)
|
||||
|
||||
"To understand reality, we must compare our expectations against reality."
|
||||
(= __ (+ 1 1))
|
||||
"To understand reality, we must compare our expectations against reality."
|
||||
(= __ (+ 1 1))
|
||||
|
||||
"You can test equality of many things"
|
||||
(= (+ 3 4) __ (+ 2 __)))
|
||||
"You can test equality of many things"
|
||||
(= (+ 3 4) __ (+ 2 __)))
|
||||
|
@ -1,16 +1,16 @@
|
||||
(meditations
|
||||
"Sets are another important data structure in clojure"
|
||||
(= #{} (set nil))
|
||||
"Sets are another important data structure in clojure"
|
||||
(= #{} (set nil))
|
||||
|
||||
"Remember that a set is a 'set'"
|
||||
(= __ (set '(1 1 2 2 3 3 4 4 5 5)))
|
||||
"Remember that a set is a 'set'"
|
||||
(= __ (set '(1 1 2 2 3 3 4 4 5 5)))
|
||||
|
||||
"You can ask clojure for the union of two sets"
|
||||
(= __ (clojure.set/union #{1 2 3 4} #{2 3 5}))
|
||||
"You can ask clojure for the union of two sets"
|
||||
(= __ (clojure.set/union #{1 2 3 4} #{2 3 5}))
|
||||
|
||||
"And also the intersection"
|
||||
(= __ (clojure.set/intersection #{1 2 3 4} #{2 3 5}))
|
||||
"And also the intersection"
|
||||
(= __ (clojure.set/intersection #{1 2 3 4} #{2 3 5}))
|
||||
|
||||
"But don't forget about the difference"
|
||||
(= __ (clojure.set/difference #{1 2 3 4 5} #{2 3 5})))
|
||||
"But don't forget about the difference"
|
||||
(= __ (clojure.set/difference #{1 2 3 4 5} #{2 3 5})))
|
||||
|
||||
|
@ -1,27 +1,27 @@
|
||||
(meditations
|
||||
"You can use vectors in clojure to create an 'Array' like structure"
|
||||
(= __ (.size (vec nil)))
|
||||
"You can use vectors in clojure to create an 'Array' like structure"
|
||||
(= __ (.size (vec nil)))
|
||||
|
||||
"You can create a vector in two ways"
|
||||
(= [] (vec nil))
|
||||
"You can create a vector in two ways"
|
||||
(= [] (vec nil))
|
||||
|
||||
"And populate it in either of these ways"
|
||||
(= [1] (vec '(1)))
|
||||
"And populate it in either of these ways"
|
||||
(= [1] (vec '(1)))
|
||||
|
||||
"But you can populate it with any number of elements at once"
|
||||
(= [1 __] (vec '(1 2)))
|
||||
"But you can populate it with any number of elements at once"
|
||||
(= [1 __] (vec '(1 2)))
|
||||
|
||||
"And add to it as well"
|
||||
(= __ (conj (vec nil) 333))
|
||||
"And add to it as well"
|
||||
(= __ (conj (vec nil) 333))
|
||||
|
||||
"You can get the first element of a vector like so"
|
||||
(= :peanut (first [:peanut :butter :and :jelly]))
|
||||
"You can get the first element of a vector like so"
|
||||
(= :peanut (first [:peanut :butter :and :jelly]))
|
||||
|
||||
"And the last in a similar fashion"
|
||||
(= __ (last [:peanut :butter :and :jelly]))
|
||||
"And the last in a similar fashion"
|
||||
(= __ (last [:peanut :butter :and :jelly]))
|
||||
|
||||
"Or any index if you wish"
|
||||
(= __ (nth [:peanut :butter :and :jelly] 3))
|
||||
"Or any index if you wish"
|
||||
(= __ (nth [:peanut :butter :and :jelly] 3))
|
||||
|
||||
"You can also slice a vector"
|
||||
(= __ (subvec [:peanut :butter :and :jelly] 1 3)))
|
||||
"You can also slice a vector"
|
||||
(= __ (subvec [:peanut :butter :and :jelly] 1 3)))
|
||||
|
Loading…
Reference in New Issue
Block a user