clojure-koans/src/koans/04_sets.clj
Colin Jones 78c5704f34 Rename to use underscores instead of dashes
Works fine either way - this is just since underscores are required
in filenames for real projects, so it's something good for folks to
get used to.
2012-06-08 15:22:42 -05:00

19 lines
514 B
Clojure

(meditations
"You can create a set in two ways"
(= #{} (set __))
"They are another important data structure in clojure"
(= __ (count #{1 2 3}))
"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}))
"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})))