tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
15
Task/Set/Clojure/set.clj
Normal file
15
Task/Set/Clojure/set.clj
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(require 'clojure.set)
|
||||
|
||||
; sets can be created using the set method or set literal syntax
|
||||
(def a (set [1 2 3 4]))
|
||||
(def b #{4 5 6 7})
|
||||
|
||||
(a 10) ; returns the element if it's contained in the set, otherwise nil
|
||||
|
||||
(clojure.set/union a b)
|
||||
|
||||
(clojure.set/intersection a b)
|
||||
|
||||
(clojure.set/difference a b)
|
||||
|
||||
(clojure.set/subset? a b)
|
||||
Loading…
Add table
Add a link
Reference in a new issue