Clojure lightning talk

341 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
341
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Clojure lightning talk

  1. 1. Clojure
  2. 2. Calc(defn calc [op v1 v2] (cond (= "+" op) (+ v1 v2) (= "-" op) (- v1 v2) (= "*" op) (* v1 v2) (= "/" op) (/ v1 v2)))
  3. 3. Set - Intersectionuser=> (clojure.core/refer clojure.set)user=> (def s #{1 2 3 4 })user=> (def s2 #{3 4 5 6 7})user=> (intersection s)#{1 2 3 4}user=> (intersection s s2)#{3 4}user=> (def s3 #{2 3 9 0})user=> (intersection s s2 s3)#{3}
  4. 4. Set - Differenceuser=> (difference s)#{1 2 3 4}user=> (difference s s2)#{1 2}user=> (difference s s2 s3)#{1}
  5. 5. Set - Unionuser=> (union s)#{1 2 3 4}user=> (union s s2)#{1 2 3 4 5 6 7}user=> (union s s2 s3)#{0 1 2 3 4 5 6 7 9}

×