SlideShare a Scribd company logo
Clojure
Calc

(defn calc [op v1 v2]
   (cond (= "+" op) (+ v1 v2)
         (= "-" op) (- v1 v2)
          (= "*" op) (* v1 v2)
          (= "/" op) (/ v1 v2)
))
Set - Intersection
user=> (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}
Set - Difference
user=> (difference s)
#{1 2 3 4}
user=> (difference s s2)
#{1 2}
user=> (difference s s2 s3)
#{1}
Set - Union
user=> (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}

More Related Content

What's hot

Simple flat ui css accordion
Simple flat ui css accordionSimple flat ui css accordion
Simple flat ui css accordion
Samsury Blog
 
Rafael torrest
Rafael torrestRafael torrest
Rafael torrest
rfltorres
 
Numeros primos
Numeros primosNumeros primos
Numeros primos
Mario Cardenas
 
Volley cert
Volley certVolley cert

What's hot (8)

Simple flat ui css accordion
Simple flat ui css accordionSimple flat ui css accordion
Simple flat ui css accordion
 
Rafael torrest
Rafael torrestRafael torrest
Rafael torrest
 
Excerpt
ExcerptExcerpt
Excerpt
 
Excerpt
ExcerptExcerpt
Excerpt
 
Numeros primos
Numeros primosNumeros primos
Numeros primos
 
Assignment
AssignmentAssignment
Assignment
 
Some logics
Some logicsSome logics
Some logics
 
Volley cert
Volley certVolley cert
Volley cert
 

Viewers also liked

Clojure lightning talk
Clojure lightning talkClojure lightning talk
Clojure lightning talk
Christophe Marchal
 
Patch in 5 minutes
Patch in 5 minutesPatch in 5 minutes
Patch in 5 minutes
Christophe Marchal
 
Reactive application
Reactive applicationReactive application
Reactive application
Christophe Marchal
 
Continuous deployment in 15 minutes
Continuous deployment in 15 minutesContinuous deployment in 15 minutes
Continuous deployment in 15 minutes
Christophe Marchal
 
Refactoring techniques
Refactoring techniquesRefactoring techniques
Refactoring techniques
Christophe Marchal
 
Gpars 5-minutes
Gpars 5-minutesGpars 5-minutes
Gpars 5-minutes
Christophe Marchal
 

Viewers also liked (7)

Clojure lightning talk
Clojure lightning talkClojure lightning talk
Clojure lightning talk
 
Patch in 5 minutes
Patch in 5 minutesPatch in 5 minutes
Patch in 5 minutes
 
Reactive application
Reactive applicationReactive application
Reactive application
 
Book club presentation kanban
Book club presentation   kanbanBook club presentation   kanban
Book club presentation kanban
 
Continuous deployment in 15 minutes
Continuous deployment in 15 minutesContinuous deployment in 15 minutes
Continuous deployment in 15 minutes
 
Refactoring techniques
Refactoring techniquesRefactoring techniques
Refactoring techniques
 
Gpars 5-minutes
Gpars 5-minutesGpars 5-minutes
Gpars 5-minutes
 

More from Christophe Marchal

Elasticsearch avoiding hotspots
Elasticsearch  avoiding hotspotsElasticsearch  avoiding hotspots
Elasticsearch avoiding hotspots
Christophe Marchal
 
Performance
PerformancePerformance
Performance
Christophe Marchal
 
Alluxio
AlluxioAlluxio
Elasticsearch cluster deep dive
Elasticsearch  cluster deep diveElasticsearch  cluster deep dive
Elasticsearch cluster deep dive
Christophe Marchal
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
Christophe Marchal
 
Reactive programming with Rxjava
Reactive programming with RxjavaReactive programming with Rxjava
Reactive programming with Rxjava
Christophe Marchal
 
Terraform
TerraformTerraform
Consul in 5 minutes
Consul in 5 minutesConsul in 5 minutes
Consul in 5 minutes
Christophe Marchal
 
Spark in 15 min
Spark in 15 minSpark in 15 min
Spark in 15 min
Christophe Marchal
 
Microservices Architecture: Nirvana or Nightmare
Microservices Architecture: Nirvana or NightmareMicroservices Architecture: Nirvana or Nightmare
Microservices Architecture: Nirvana or Nightmare
Christophe Marchal
 
Capistrano
CapistranoCapistrano
Capistrano
Christophe Marchal
 
Aws, play! couch db scaling soa in the cloud
Aws, play! couch db  scaling soa in the cloudAws, play! couch db  scaling soa in the cloud
Aws, play! couch db scaling soa in the cloud
Christophe Marchal
 
Devops e a nova cultura - TDC Florianopolis 2015
Devops e a nova cultura - TDC Florianopolis 2015Devops e a nova cultura - TDC Florianopolis 2015
Devops e a nova cultura - TDC Florianopolis 2015
Christophe Marchal
 
Devops and the New Culture
Devops and the New CultureDevops and the New Culture
Devops and the New Culture
Christophe Marchal
 
CUDA
CUDACUDA
Monads in practice
Monads in practiceMonads in practice
Monads in practice
Christophe Marchal
 
Productivity and scalability with Play and Scala
Productivity and scalability with Play and ScalaProductivity and scalability with Play and Scala
Productivity and scalability with Play and Scala
Christophe Marchal
 
Internet of things and arduino
Internet of things and arduinoInternet of things and arduino
Internet of things and arduino
Christophe Marchal
 
Hbase
HbaseHbase
Integration with hdfs using WebDFS and NFS
Integration with hdfs using WebDFS and NFSIntegration with hdfs using WebDFS and NFS
Integration with hdfs using WebDFS and NFSChristophe Marchal
 

More from Christophe Marchal (20)

Elasticsearch avoiding hotspots
Elasticsearch  avoiding hotspotsElasticsearch  avoiding hotspots
Elasticsearch avoiding hotspots
 
Performance
PerformancePerformance
Performance
 
Alluxio
AlluxioAlluxio
Alluxio
 
Elasticsearch cluster deep dive
Elasticsearch  cluster deep diveElasticsearch  cluster deep dive
Elasticsearch cluster deep dive
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 
Reactive programming with Rxjava
Reactive programming with RxjavaReactive programming with Rxjava
Reactive programming with Rxjava
 
Terraform
TerraformTerraform
Terraform
 
Consul in 5 minutes
Consul in 5 minutesConsul in 5 minutes
Consul in 5 minutes
 
Spark in 15 min
Spark in 15 minSpark in 15 min
Spark in 15 min
 
Microservices Architecture: Nirvana or Nightmare
Microservices Architecture: Nirvana or NightmareMicroservices Architecture: Nirvana or Nightmare
Microservices Architecture: Nirvana or Nightmare
 
Capistrano
CapistranoCapistrano
Capistrano
 
Aws, play! couch db scaling soa in the cloud
Aws, play! couch db  scaling soa in the cloudAws, play! couch db  scaling soa in the cloud
Aws, play! couch db scaling soa in the cloud
 
Devops e a nova cultura - TDC Florianopolis 2015
Devops e a nova cultura - TDC Florianopolis 2015Devops e a nova cultura - TDC Florianopolis 2015
Devops e a nova cultura - TDC Florianopolis 2015
 
Devops and the New Culture
Devops and the New CultureDevops and the New Culture
Devops and the New Culture
 
CUDA
CUDACUDA
CUDA
 
Monads in practice
Monads in practiceMonads in practice
Monads in practice
 
Productivity and scalability with Play and Scala
Productivity and scalability with Play and ScalaProductivity and scalability with Play and Scala
Productivity and scalability with Play and Scala
 
Internet of things and arduino
Internet of things and arduinoInternet of things and arduino
Internet of things and arduino
 
Hbase
HbaseHbase
Hbase
 
Integration with hdfs using WebDFS and NFS
Integration with hdfs using WebDFS and NFSIntegration with hdfs using WebDFS and NFS
Integration with hdfs using WebDFS and NFS
 

Clojure lightning talk

  • 2. Calc (defn calc [op v1 v2] (cond (= "+" op) (+ v1 v2) (= "-" op) (- v1 v2) (= "*" op) (* v1 v2) (= "/" op) (/ v1 v2) ))
  • 3. Set - Intersection user=> (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. Set - Difference user=> (difference s) #{1 2 3 4} user=> (difference s s2) #{1 2} user=> (difference s s2 s3) #{1}
  • 5. Set - Union user=> (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}