Update 05_sets.clj

This commit is contained in:
brannx 2018-03-15 15:32:25 +03:00 committed by GitHub
parent a55623398f
commit 46496626ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,20 +3,20 @@
[clojure.set :as set])) [clojure.set :as set]))
(meditations (meditations
"You can create a set by converting another collection" "Создаём множество из другой коллекции"
(= #{3} (set __)) (= #{3} (set __))
"Counting them is like counting other collections" "Считаем как обычно"
(= __ (count #{1 2 3})) (= __ (count #{1 2 3}))
"Remember that a set is a *mathematical* set" "Множество — оно математическое"
(= __ (set '(1 1 2 2 3 3 4 4 5 5))) (= __ (set '(1 1 2 2 3 3 4 4 5 5)))
"You can ask clojure for the union of two sets" "Объединение"
(= __ (set/union #{1 2 3 4} #{2 3 5})) (= __ (set/union #{1 2 3 4} #{2 3 5}))
"And also the intersection" "Пересечение"
(= __ (set/intersection #{1 2 3 4} #{2 3 5})) (= __ (set/intersection #{1 2 3 4} #{2 3 5}))
"But don't forget about the difference" "Разность"
(= __ (set/difference #{1 2 3 4 5} #{2 3 5}))) (= __ (set/difference #{1 2 3 4 5} #{2 3 5})))