Clojure

5 things you should know

AKAICamp #4: Backend

October 28, 2014
@zaiste

Prologue

OOP: Alan Key

Objects communicate by asynchronous message passing

Programmer

Founded Nukomeet / Started RuPy & PolyConf

Why Clojure?

Simplicity & Power

Short



public class StringUtils {
     public static boolean isBlank(String str) {
          int strLen;
          if (str == null || (strLen = str.length()) == 0) {
               return true;
          }
     }

     for (int i = 0; i < strLen; i++) {
          if ((Character.isWhitespace(str.charAt(i)) == false)) {
               return false;
          }
     }
     return true;
}
          

(defn blank? [str]
  (every? #(Character/isWhitespace %) str))
          

Pragmatic

1 - Lisp

Minimal

No syntax

Homoiconic

« Reprogram » w/ macros

Ultimate Solution

Paul Graham's « Revenge of the nerds »

2 - Functional Programming

First-class functions

Functions as datatype: passed around, returned, etc.

Laziness

Postpone the evaluation till it's needed

Referential Transparency

Pure functions by definition

3 - Immutable & Persistent Data Structures

Immutable

Easier concurrent programming

Persistent

Preserve old copies / Efficiently share structure

4 - State Management

State

the value of an identity at a point in time

Reference Model

Clear separation between identity and value.

Concurrent vs. Parallel

5 - Interoperability

JVM Performance

Libraries

More

Website / GitHub / Google Group / IRC #clojure

Clojure Trainings

1 day introduction to Clojure

Subscribe

Q? / Thank you