Finished fifth koan
This commit is contained in:
parent
01be68930b
commit
762488cb8e
1 changed files with 6 additions and 6 deletions
|
|
@ -4,19 +4,19 @@
|
||||||
|
|
||||||
(meditations
|
(meditations
|
||||||
"You can create a set by converting another collection"
|
"You can create a set by converting another collection"
|
||||||
(= #{3} (set __))
|
(= #{3} (set '(3)))
|
||||||
|
|
||||||
"Counting them is like counting other collections"
|
"Counting them is like counting other collections"
|
||||||
(= __ (count #{1 2 3}))
|
(= 3 (count #{1 2 3}))
|
||||||
|
|
||||||
"Remember that a set is a *mathematical* set"
|
"Remember that a set is a *mathematical* set"
|
||||||
(= __ (set '(1 1 2 2 3 3 4 4 5 5)))
|
(= #{1 2 3 4 5} (set '(1 1 2 2 3 3 4 4 5 5)))
|
||||||
|
|
||||||
"You can ask clojure for the union of two sets"
|
"You can ask clojure for the union of two sets"
|
||||||
(= __ (set/union #{1 2 3 4} #{2 3 5}))
|
(= #{1 2 3 4 5} (set/union #{1 2 3 4} #{2 3 5}))
|
||||||
|
|
||||||
"And also the intersection"
|
"And also the intersection"
|
||||||
(= __ (set/intersection #{1 2 3 4} #{2 3 5}))
|
(= #{2 3} (set/intersection #{1 2 3 4} #{2 3 5}))
|
||||||
|
|
||||||
"But don't forget about the difference"
|
"But don't forget about the difference"
|
||||||
(= __ (set/difference #{1 2 3 4 5} #{2 3 5})))
|
(= #{1 4} (set/difference #{1 2 3 4 5} #{2 3 5})))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue