Clojure

A quick introduction to the pragmatic LISP for the JVM

A pragmatic LISP for the JVM

A pragmatic LISP for the JVM

A pragmatic LISP for the JVM

A pragmatic LISP for the JVM

Why talk about this?

Complexity

1958

John McCarthy

1958!

A long time passes...

2007

Rich Hickey

Creating a practical LISP

  • Immutable data structures
  • Multicore concurrency
  • Interop

Clojure key points

  • Clojure is a LISP
  • Runs anywhere Java does
  • Offers a better FP abstraction

Allows developers to use sixty-year old technology!

Anatomy of a LISP

Lisp syntax

  • Tiny core
  • Much syntax sugar
  • Such brackets
  • Wow!

Names (Identifiers)

  • f
  • g
  • my-function
  • my-value
  • tuple-2

Values

  • 2
  • "Two"
  • \T
  • :two
  • (+ 1 1)

S-expressions

  • (f)
  • (str "Hello" "World")
  • (+ 1 2 3)
  • (+ 1 (+ 2 3))

Identity and Value

(def robert-rees "Robert Rees")

(def robert-rees "Rob Rees")

Identity and value

  • (def a 1)
  • (defn double [a] (* 2 a))
  • (def double (fn [a] (* 2 a))

Behaviour

Laziness

Schrödinger's Cat

  • (def box (atom (maybe-kill :cat)))
  • (@a)

REPL

RE

Clojure conclusions

  • Clojure is a LISP
  • Runs anywhere Java does
  • Offers a better FP abstraction
  • Has an unconventional syntax

Allows developers to use sixty-year old technology!

Clojure

By Robert Rees

Clojure

  • 2,052