Clojure - Revenge of the Verbs

Preview:

Citation preview

clojure“revenge of the verbs”

tim@lossen.de2008-12-04

LISP

dynamic, functional, lazy

_not_ object-oriented

compiled (to JVM bytecode)

on-the-fly or ahead-of-time

(def fibs (lazy-cat '(0 1) (map + fibs (drop 1 fibs))))

Syntax

Nothing nil

Booleans true false

Numbers 10 22.31 2/3

Strings ”foo”

Characters \a \space \newline

Regexps #”[a-z]+”

Comments ;this is a hack

Symbols foo namespace/foo java.util.BitSet

Keywords :foo :bar

Lists (a b c)

Vectors [1 2 3]

Maps {:a 1 :b 2}

Sets #{:a :b :c}

Semantics

literals evaluate to themselves

vectors and maps are data

symbols are resolved

non-empty lists are calls

calls (operator operands*)

special forms def if let fn

macros and defn time

functions + = str println

large sequence library

Concurrency

persistent data structures

“state - you’re doing it wrong”

lists, vectors, maps, sets ...

structural sharing

Vars - thread-local

Refs - transactional

Agents - asynchronous

Links

Project http://clojure.org

Presentations http://clojure.blip.tv

Book “Programming Clojure” (beta) http://pragprog.com/titles/shcloj

TextMate Bundle http://github.com/nullstyle/clojure-tmbundle/