Clojure

How, When, and Why?

Nikola Plejić

(defn add-two-numbers
  [x y]
  (+ x y))
(defn wat?
  [no-idea*])

Clojure...

(let [d (java.util.Date.)]
     (.getTime d))

Clojure...

Pre-/Post-conditions

(defn some-like-it-even [x]
      {:pre [(even? x)]
       :post [(> % 0)]}
      x)

;; user=> (some-like-it-even 2)
;; 2
;; user=> (some-like-it-even 3)
;; AssertionError Assert failed: (even? x)
;; user=> (some-like-it-even 0)
;; AssertionError Assert failed: (> % 0)

Typed Clojure

Clojure...

Functional

Macros

;; http://www.braveclojure.com/writing-macros/
(defmacro postfix-notation
  "I'm too indie for prefix notation"
  [expression]
  (conj (butlast expression) (last expression)))

;; (postfix-notation (1 1 +))
;; => 2

Light Table

Leiningen

Use Case(s)

Motivation

Why Clojure?

PHP Interop

Databases

Databases

Other / Smaller Libs

Development Time

Result

Deployment

Bottom Line


to the moon & beyond

Thank you!

nikola.plejic.com/talks/clojureintro

nikola.plejic.com / nikola@plejic.com