SlideShare a Scribd company logo
for Java developers
Clojure
jan.kronquist@jayway.com
onsdag 25 september 13
About me
onsdag 25 september 13
About me
1986 - Basic
onsdag 25 september 13
About me
1990 - 68K assembly
1986 - Basic
onsdag 25 september 13
About me
1990 - 68K assembly1986 - Basic
1995 - OOP
onsdag 25 september 13
1997 - University
About me
1990 - 68K assembly1986 - Basic
1995 - OOP
onsdag 25 september 13
1997 - University
About me
1990 - 68K assembly1986 - Basic
2005 - IoC,Aspects, Mixins
1995 - OOP
onsdag 25 september 13
2008 - Functional 1997 - University
About me
1990 - 68K assembly1986 - Basic
2005 - IoC,Aspects, Mixins
1995 - OOP
onsdag 25 september 13
2012 - Lisp & dynamic typing
2008 - Functional
1997 - University
About me
1990 - 68K assembly1986 - Basic
2005 - IoC,Aspects, Mixins
1995 - OOP
onsdag 25 september 13
This talk is not
A comprehensive introduction to Clojure
About idiomatic Clojure
Another talk about functional programming
onsdag 25 september 13
Killer apps
onsdag 25 september 13
Killer apps
Prismatic
onsdag 25 september 13
Killer apps
Prismatic
onsdag 25 september 13
Killer apps
Prismatic
Datomic
Storm
ClojureScript
onsdag 25 september 13
What is Clojure?
Created 2007 by Rich Hickey
Lisp
Runs on JVM, CLR & JavaScript
Design for concurrency
onsdag 25 september 13
Clojure example
(defn divisible? [n d]
(== 0 (mod n d)))
(defn divides [n]
(partial divisible? n))
(declare primes)
(defn prime? [n]
(not (some (divides n) (take-while #(< % n) primes))))
(def primes (lazy-cat
[2 3 5]
(filter prime? (drop 7 (range)))))
onsdag 25 september 13
Why Clojure?
onsdag 25 september 13
Why Clojure?
Lisp - Code as data & Syntactic abstraction
onsdag 25 september 13
Why Clojure?
Lisp - Code as data & Syntactic abstraction
Functional - Declarative, Immutable
onsdag 25 september 13
Why Clojure?
Lisp - Code as data & Syntactic abstraction
Functional - Declarative, Immutable
Interactive development environment
onsdag 25 september 13
Why Clojure?
Lisp - Code as data & Syntactic abstraction
Functional - Declarative, Immutable
Interactive development environment
Great eco-system - dynamic helps compatibility
onsdag 25 september 13
Why Clojure?
Lisp - Code as data & Syntactic abstraction
Functional - Declarative, Immutable
Interactive development environment
Great eco-system - dynamic helps compatibility
Wrapper-free Java access
onsdag 25 september 13
Why Clojure?
Lisp - Code as data & Syntactic abstraction
Functional - Declarative, Immutable
Interactive development environment
Great eco-system - dynamic helps compatibility
Wrapper-free Java access
Less complexity
onsdag 25 september 13
Common complaints
onsdag 25 september 13
Common complaints
Lisp looks weird
onsdag 25 september 13
Common complaints
Dynamic typing is scary
Lisp looks weird
onsdag 25 september 13
Common complaints
Dynamic typing is scary
Lisp looks weird
Just a toy language
onsdag 25 september 13
Common complaints
Dynamic typing is scary
Lisp looks weird
Macros? Are you crazy?
Just a toy language
onsdag 25 september 13
Lispness
onsdag 25 september 13
Clojure Atomic Data Types
Arbitrary precision integers: 12345678987654
Doubles: 1.234
BigDecimals: 1.234M
Ratios: 22/7
Strings: "fred" , Characters: a b c
Symbols: fred ethel , Keywords: :fred :ethel
Booleans: true false , Null: - nil
Regex patterns #"a*b"
Rich Hickey - Clojure for Java Programmers - http://www.youtube.com/watch?v=P76Vbsk_3J0
onsdag 25 september 13
JavaScript Data Structures
Arrays
[1, 2, 3] ["fred", "ethel", "lucy"]
Objects
{name: "Jan Kronquist", age: 37}
onsdag 25 september 13
Clojure Data Structures
Vectors
[1, 2, 3] ["fred", "ethel", "lucy"]
Maps
{:name "Jan Kronquist", :age 37}
move colon
onsdag 25 september 13
Clojure Data Structures
Vectors
[1 2 3] ["fred" "ethel" "lucy"]
Maps
{:name "Jan Kronquist" :age 37}
commas are whitespace!
onsdag 25 september 13
Clojure Data Structures
Vectors - indexed access
[1 2 3] ["fred" "ethel" "lucy"]
Maps
{:name "Jan Kronquist" :age 37}
Lists - singly linked
(1 2 3 4 5) (fred ethel lucy) (list 1 2 3)
Sets
#{fred ethel lucy}
onsdag 25 september 13
Demo in REPL
user=> "hello"
"hello"
user=> 5
5
user=> [1 2 3]
[1 2 3]
user=> qwe
java.lang.RuntimeException: Unable to resolve symbol: qwe
user=> (def qwe "hello world")
#'user/qwe
user=> qwe
"hello world"
onsdag 25 september 13
"Hello world")
The strangeness of Lisp
println(
onsdag 25 september 13
"Hello world")
The strangeness of Lisp
println(
onsdag 25 september 13
"Hello world")
The strangeness of Lisp
println(
(operator operand1 operand2 ...)
Determines how the list is evaluated
onsdag 25 september 13
(= (.toString (+ 1 2)) "3")
Example evaluation
(= (.toString (+ 1 2)) "3")
onsdag 25 september 13
(= (.toString (+ 1 2)) "3")
Example evaluation
onsdag 25 september 13
(= (.toString (+ 1 2)) "3")
Example evaluation
(= (.toString 3) "3")
onsdag 25 september 13
(= (.toString (+ 1 2)) "3")
Example evaluation
(= (.toString 3) "3")
(= "3" "3")
onsdag 25 september 13
(= (.toString (+ 1 2)) "3")
Example evaluation
(= (.toString 3) "3")
(= "3" "3")
true
onsdag 25 september 13
onsdag 25 september 13
int i = 5; (def i 5) OR (let [i 5] ...)
if (x > 5) {
return y;
} else {
return z;
}
(if (> x 5)
y
z)
x * y * z (* x y z)
foo(x, y, z) (foo x y z)
object.method(x, y) (.method object x y)
public String sayHello(String x) {
return "Hello " + x;
}
(defn sayHello [x]
(str "Hello " x))
onsdag 25 september 13
int i = 5; (def i 5) OR (let [i 5] ...)
if (x > 5) {
return y;
} else {
return z;
}
(if (> x 5)
y
z)
x * y * z (* x y z)
foo(x, y, z) (foo x y z)
object.method(x, y) (.method object x y)
public String sayHello(String x) {
return "Hello " + x;
}
(defn sayHello [x]
(str "Hello " x))
onsdag 25 september 13
int i = 5; (def i 5) OR (let [i 5] ...)
if (x > 5) {
return y;
} else {
return z;
}
(if (> x 5)
y
z)
x * y * z (* x y z)
foo(x, y, z) (foo x y z)
object.method(x, y) (.method object x y)
public String sayHello(String x) {
return "Hello " + x;
}
(defn sayHello [x]
(str "Hello " x))
onsdag 25 september 13
int i = 5; (def i 5) OR (let [i 5] ...)
if (x > 5) {
return y;
} else {
return z;
}
(if (> x 5)
y
z)
x * y * z (* x y z)
foo(x, y, z) (foo x y z)
object.method(x, y) (.method object x y)
public String sayHello(String x) {
return "Hello " + x;
}
(defn sayHello [x]
(str "Hello " x))
onsdag 25 september 13
int i = 5; (def i 5) OR (let [i 5] ...)
if (x > 5) {
return y;
} else {
return z;
}
(if (> x 5)
y
z)
x * y * z (* x y z)
foo(x, y, z) (foo x y z)
object.method(x, y) (.method object x y)
public String sayHello(String x) {
return "Hello " + x;
}
(defn sayHello [x]
(str "Hello " x))
onsdag 25 september 13
int i = 5; (def i 5) OR (let [i 5] ...)
if (x > 5) {
return y;
} else {
return z;
}
(if (> x 5)
y
z)
x * y * z (* x y z)
foo(x, y, z) (foo x y z)
object.method(x, y) (.method object x y)
public String sayHello(String x) {
return "Hello " + x;
}
(defn sayHello [x]
(str "Hello " x))
onsdag 25 september 13
Java Quiz
	 public static void main(String[] args) {
	 	 int bang = 1;
do while (bang>=1)
System.out.print(" bang is "+ bang);
while (bang>1);
	 }
onsdag 25 september 13
Macros
onsdag 25 september 13
Working with Java classes
(defn display [text]
(let [frame (new JFrame "MyFrame")]
(.add frame (new JLabel text))
(.setSize frame 300 200)
(.setVisible frame true)))
static void display(String text) {
	 JFrame frame = new JFrame("MyFrame");
	 frame.add(new JLabel(text));
	 frame.setSize(300, 200);
	 frame.setVisible(true);
}
onsdag 25 september 13
Working with Java classes
(defn display [text]
(let [frame (new JFrame "MyFrame")]
(.add frame (new JLabel text))
(.setSize frame 300 200)
(.setVisible frame true)))
static void display(String text) {
	 JFrame frame = new JFrame("MyFrame");
	 frame.add(new JLabel(text));
	 frame.setSize(300, 200);
	 frame.setVisible(true);
}
(display "Hello World")
onsdag 25 september 13
Working with Java classes
(defn display [text]
(let [frame (new JFrame "MyFrame")]
(.add frame (new JLabel text))
(.setSize frame 300 200)
(.setVisible frame true)))
static void display(String text) {
	 JFrame frame = new JFrame("MyFrame");
	 frame.add(new JLabel(text));
	 frame.setSize(300, 200);
	 frame.setVisible(true);
}
a pattern!
onsdag 25 september 13
static void display(String text) {
	 JFrame frame = new JFrame("MyFrame");
	 with (frame) {
	 	 .add(new JLabel(text));
	 	 .setSize(300, 200);
	 	 .setVisible(true);
	 }
}
Working with Java classes
(defn display [text]
(let [frame (new JFrame "MyFrame")]
(.add frame (new JLabel text))
(.setSize frame 300 200)
(.setVisible frame true)))
onsdag 25 september 13
(defn display [text]
(let [frame (new JFrame "MyFrame")]
(doto frame
(.add (new JLabel text))
(.setSize 300 200)
(.setVisible true))))
Working with Java classes
static void display(String text) {
	 JFrame frame = new JFrame("MyFrame");
	 with (frame) {
	 	 .add(new JLabel(text));
	 	 .setSize(300, 200);
	 	 .setVisible(true);
	 }
}
onsdag 25 september 13
(defn display [text]
(doto (new JFrame "MyFrame")
(.add (new JLabel text))
(.setSize 300 200)
(.setVisible true)))
Working with Java classes
static void display(String text) {
	 JFrame frame = new JFrame("MyFrame");
	 frame.add(new JLabel(text));
	 frame.setSize(300, 200);
	 frame.setVisible(true);
}
onsdag 25 september 13
(defn display [text]
(doto (new JFrame "MyFrame")
(.add (new JLabel text))
(.setSize 300 200)
(.setVisible true)))
Working with Java classes
static void display(String text) {
	 JFrame frame = new JFrame("MyFrame");
	 frame.add(new JLabel(text));
	 frame.setSize(300, 200);
	 frame.setVisible(true);
}
Ok, nice,
but in practice you would
never want something like this?
onsdag 25 september 13
static void write(String fileName, String text) throws IOException {
	 try (Writer writer = new FileWriter(fileName)) {
	 	 writer.write(text);
	 }
}
Trust me, you want macros
onsdag 25 september 13
static void write(String fileName, String text) throws IOException {
	 try (Writer writer = new FileWriter(fileName)) {
	 	 writer.write(text);
	 }
}
Trust me, you want macros
(defn write [fileName text]
(with-open [writer (new FileWriter fileName)]
(.write writer text)))
onsdag 25 september 13
Toy?
onsdag 25 september 13
Structure in
Modules - package
Abstraction - interface
Implementation - class
onsdag 25 september 13
Structure in
Modules - package
Abstraction - interface
Implementation - class
Problems
mutable state?
static methods?
inheritance?
constants?
onsdag 25 september 13
Structure in
Modules
namespace - first-class, dynamic, import, aliasing
Abstraction
defprotocol - can be added later
Implementation
defrecord - immutable, equals, hashcode, etc
deftype - may mutate, only user functionilty
reify - singleton
gen-class & proxy - for Java interop
onsdag 25 september 13
Records - creating
(ns my.namespace)
(defrecord Person [firstName lastName])
(new Person "Jan" "Kronquist")
onsdag 25 september 13
Records - creating
; #my.namespace.Person{:firstName "Jan", :lastName "Kronquist"}
(ns my.namespace)
(defrecord Person [firstName lastName])
(new Person "Jan" "Kronquist")
onsdag 25 september 13
Records - field access
; #my.namespace.Person{:firstName "Jan", :lastName "Kronquist"}
(ns my.namespace)
(defrecord Person [firstName lastName])
(new Person "Jan" "Kronquist")
(def person (new Person "Jan" "Kronquist"))
(.firstName person)
onsdag 25 september 13
Records - field access
; #my.namespace.Person{:firstName "Jan", :lastName "Kronquist"}
(ns my.namespace)
(defrecord Person [firstName lastName])
(new Person "Jan" "Kronquist")
(def person (new Person "Jan" "Kronquist"))
(.firstName person)
; "Jan"
onsdag 25 september 13
Records - named parameters
; #my.namespace.Person{:firstName "Jan", :lastName "Kronquist"}
(ns my.namespace)
(defrecord Person [firstName lastName])
(new Person "Jan" "Kronquist")
(def person (new Person "Jan" "Kronquist"))
(.firstName person)
; "Jan"
(map->Person {:lastName "Kronquist" :firstName "Jan"})
onsdag 25 september 13
Records - named parameters
; #my.namespace.Person{:firstName "Jan", :lastName "Kronquist"}
(ns my.namespace)
(defrecord Person [firstName lastName])
(new Person "Jan" "Kronquist")
(def person (new Person "Jan" "Kronquist"))
(.firstName person)
; "Jan"
(map->Person {:lastName "Kronquist" :firstName "Jan"})
; #my.namespace.Person{:firstName "Jan", :lastName "Kronquist"}
onsdag 25 september 13
Records and protocols
(defprotocol Nameable
(getName [this]))
onsdag 25 september 13
Records and protocols
(defprotocol Nameable
(getName [this]))
(defrecord Person [firstName lastName]
Nameable
(getName [this] (str firstName " " lastName)))
(getName (new Person "Jan" "Kronquist"))
; "Jan Kronquist"
Person class implements
Nameable interface
onsdag 25 september 13
Records and protocols
(defprotocol Nameable
(getName [this]))
(defrecord Person [firstName lastName])
(extend-protocol Nameable
Person
(getName [this] (str (.firstName this) " " (.lastName this))))
(getName (new Person "Jan" "Kronquist"))
; "Jan Kronquist"
(defrecord Person [firstName lastName]
Nameable
(getName [this] (str firstName " " lastName)))
(getName (new Person "Jan" "Kronquist"))
; "Jan Kronquist"
Person class implements
Nameable interface
Person extended by
Nameable after definition!
onsdag 25 september 13
Records and protocols
(defprotocol Nameable
(getName [this]))
(defrecord Person [firstName lastName])
(extend-protocol Nameable
Person
(getName [this] (str (.firstName this) " " (.lastName this))))
(getName (new Person "Jan" "Kronquist"))
; "Jan Kronquist"
(defrecord Person [firstName lastName]
Nameable
(getName [this] (str firstName " " lastName)))
(.getName (new Person "Jan" "Kronquist"))
; "Jan Kronquist"
Method getName
exists on Person class
onsdag 25 september 13
Records and protocols
(defprotocol Nameable
(getName [this]))
(defrecord Person [firstName lastName])
(extend-protocol Nameable
Person
(getName [this] (str (.firstName this) " " (.lastName this))))
(.getName (new Person "Jan" "Kronquist"))
; IllegalArgumentException No matching field found: getName
(defrecord Person [firstName lastName]
Nameable
(getName [this] (str firstName " " lastName)))
(.getName (new Person "Jan" "Kronquist"))
; "Jan Kronquist"
Method getName
exists on Person class
But not in this case!
onsdag 25 september 13
Editors and IDEs?
Eclipse - Counterclockwise
IntelliJ - La Clojure
Light Table
Sublime
Textmate
Emacs
onsdag 25 september 13
Eclipse Counterclockwise
✓Restrictive formatting
✓Paren coloring
✓Typing suggestions
✓Being Eclipse
https://code.google.com/p/counterclockwise/
onsdag 25 september 13
Light table
✓Cool
✓Insta-REPL
http://www.lighttable.com/
onsdag 25 september 13
Sublime
✓General purpose editor
✓Typing suggestions
http://www.sublimetext.com/
onsdag 25 september 13
Repositories
Maven style
Maven central
http://clojars.org/repo
onsdag 25 september 13
Build tools
Maven plugin
Gradle plugin
Leiningen
onsdag 25 september 13
Leiningen
(defproject myproject "0.5.0-SNAPSHOT"
:description "A project for doing things."
:url "http://github.com/foo/bar"
:dependencies [[org.clojure/clojure "1.5.1"]
[ring/ring-core "1.2.0 "]]
:plugins [[lein-ring "0.4.5"]])
onsdag 25 september 13
Dynamic typing
onsdag 25 september 13
Dynamic typing?
Robert Smallshire - The Unreasonable Effectiveness of Dynamic Typing for Practical Programs
onsdag 25 september 13
Dynamic typing is scary
Compiler won’t find errors
Limited tool support
Performance?
onsdag 25 september 13
What made me think twice
Web server
onsdag 25 september 13
What made me think twice
Web server
onsdag 25 september 13
Clojure makes dynamic typing ok
REPL
Immutable data structure
Pure functions
Automated tests
onsdag 25 september 13
Dynamic typing and performance?
Clojure is compiled to bytecode
Generally good enough!
onsdag 25 september 13
Dynamic typing and performance?
Clojure is compiled to bytecode
Generally good enough!
(defn len [^String x]
(.length x))
onsdag 25 september 13
Studies
Stefan Hanenberg & Lutz Prechelt
Dynamic is more productive
No difference in reliability
Robert Smallshire - 2 % defects are type errors (GitHub)
onsdag 25 september 13
Conclusion
onsdag 25 september 13
Macros? Are you crazy?
Dynamic typing is scary
Convinced?
Lisp looks weird
Just a toy language
onsdag 25 september 13
Macros? Are you crazy?
Dynamic typing is usable
Convinced?
Lisp looks weird
Just a toy language
REPL
Immutable data structure
Pure functions
Automated tests
onsdag 25 september 13
Macros? Are you crazy?
Lisp is consistent
Dynamic typing is usable
Convinced?
Just a toy language
REPL
Immutable data structure
Pure functions
Automated tests
(operation operand1 operand2 ...)
onsdag 25 september 13
Macros? Are you crazy?
Lisp is consistent
Dynamic typing is usable
Convinced? REPL
Immutable data structure
Pure functions
Automated tests
Interesting language
(operation operand1 operand2 ...)
Namespaces
Prototcols
Records
onsdag 25 september 13
Macros? Are you crazy?
Lisp is consistent
Dynamic typing is usable
Convinced? REPL
Immutable data structure
Pure functions
Automated tests
Interesting language
(operation operand1 operand2 ...)
Lazy seqs STM Functional
Namespaces
Prototcols
Records
onsdag 25 september 13
Macros? Maybe.......
Lisp is consistent
Dynamic typing is usable
Convinced? REPL
Immutable data structure
Pure functions
Automated tests
Interesting language
(operation operand1 operand2 ...)
Lazy seqs STM Functional
Namespaces
Prototcols
Records
try (Writer writer = new FileWriter(fileName))
	 writer.write(text);
}
onsdag 25 september 13
Macros? Maybe.......
Lisp is consistent
Dynamic typing is usable
Convinced? REPL
Immutable data structure
Pure functions
Automated tests
Interesting language
(operation operand1 operand2 ...)
Lazy seqs STM Functional
Namespaces
Prototcols
Records
try (Writer writer = new FileWriter(fileName))
	 writer.write(text);
}
DSL Reuse Structure
onsdag 25 september 13
Further resources
http://clojure.org/
http://tryclj.com/
http://www.4clojure.com
http://clojure-doc.org/
onsdag 25 september 13
Questions?
onsdag 25 september 13

More Related Content

What's hot (20)

core.logic introduction
core.logic introductioncore.logic introduction
core.logic introduction
Norman Richards
 
Clojure made simple - Lightning talk
Clojure made simple - Lightning talkClojure made simple - Lightning talk
Clojure made simple - Lightning talk
John Stevenson
 
AST Transformations
AST TransformationsAST Transformations
AST Transformations
HamletDRC
 
Turtle Graphics in Groovy
Turtle Graphics in GroovyTurtle Graphics in Groovy
Turtle Graphics in Groovy
Jim Driscoll
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
HamletDRC
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good code
Giordano Scalzo
 
ES6 in Real Life
ES6 in Real LifeES6 in Real Life
ES6 in Real Life
Domenic Denicola
 
The Logical Burrito - pattern matching, term rewriting and unification
The Logical Burrito - pattern matching, term rewriting and unificationThe Logical Burrito - pattern matching, term rewriting and unification
The Logical Burrito - pattern matching, term rewriting and unification
Norman Richards
 
Getting started with Clojure
Getting started with ClojureGetting started with Clojure
Getting started with Clojure
John Stevenson
 
From Java to Parellel Clojure - Clojure South 2019
From Java to Parellel Clojure - Clojure South 2019From Java to Parellel Clojure - Clojure South 2019
From Java to Parellel Clojure - Clojure South 2019
Leonardo Borges
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
Skills Matter
 
Fun never stops. introduction to haskell programming language
Fun never stops. introduction to haskell programming languageFun never stops. introduction to haskell programming language
Fun never stops. introduction to haskell programming language
Pawel Szulc
 
Java.lang.object
Java.lang.objectJava.lang.object
Java.lang.object
Soham Sengupta
 
Clojure 1.1 And Beyond
Clojure 1.1 And BeyondClojure 1.1 And Beyond
Clojure 1.1 And Beyond
Mike Fogus
 
The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84
Mahmoud Samir Fayed
 
Clojure, Plain and Simple
Clojure, Plain and SimpleClojure, Plain and Simple
Clojure, Plain and Simple
Ben Mabey
 
JavaScript Survival Guide
JavaScript Survival GuideJavaScript Survival Guide
JavaScript Survival Guide
Giordano Scalzo
 
concurrency with GPars
concurrency with GParsconcurrency with GPars
concurrency with GPars
Paul King
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
Arturo Herrero
 
Pattern Matching in Java 14
Pattern Matching in Java 14Pattern Matching in Java 14
Pattern Matching in Java 14
GlobalLogic Ukraine
 
Clojure made simple - Lightning talk
Clojure made simple - Lightning talkClojure made simple - Lightning talk
Clojure made simple - Lightning talk
John Stevenson
 
AST Transformations
AST TransformationsAST Transformations
AST Transformations
HamletDRC
 
Turtle Graphics in Groovy
Turtle Graphics in GroovyTurtle Graphics in Groovy
Turtle Graphics in Groovy
Jim Driscoll
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
HamletDRC
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good code
Giordano Scalzo
 
The Logical Burrito - pattern matching, term rewriting and unification
The Logical Burrito - pattern matching, term rewriting and unificationThe Logical Burrito - pattern matching, term rewriting and unification
The Logical Burrito - pattern matching, term rewriting and unification
Norman Richards
 
Getting started with Clojure
Getting started with ClojureGetting started with Clojure
Getting started with Clojure
John Stevenson
 
From Java to Parellel Clojure - Clojure South 2019
From Java to Parellel Clojure - Clojure South 2019From Java to Parellel Clojure - Clojure South 2019
From Java to Parellel Clojure - Clojure South 2019
Leonardo Borges
 
Fun never stops. introduction to haskell programming language
Fun never stops. introduction to haskell programming languageFun never stops. introduction to haskell programming language
Fun never stops. introduction to haskell programming language
Pawel Szulc
 
Clojure 1.1 And Beyond
Clojure 1.1 And BeyondClojure 1.1 And Beyond
Clojure 1.1 And Beyond
Mike Fogus
 
The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84
Mahmoud Samir Fayed
 
Clojure, Plain and Simple
Clojure, Plain and SimpleClojure, Plain and Simple
Clojure, Plain and Simple
Ben Mabey
 
JavaScript Survival Guide
JavaScript Survival GuideJavaScript Survival Guide
JavaScript Survival Guide
Giordano Scalzo
 
concurrency with GPars
concurrency with GParsconcurrency with GPars
concurrency with GPars
Paul King
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
Arturo Herrero
 

Viewers also liked (17)

Zarak/Resume
Zarak/Resume Zarak/Resume
Zarak/Resume
Zarak Javed
 
SmartDecision Whitepaper
SmartDecision WhitepaperSmartDecision Whitepaper
SmartDecision Whitepaper
Lubov Putsko
 
Lenguaje corporal. Body language.
Lenguaje corporal. Body language.Lenguaje corporal. Body language.
Lenguaje corporal. Body language.
Cachi Chien
 
Trinity Kings World Leadership: Patillo Family Kingdom curse all the people w...
Trinity Kings World Leadership: Patillo Family Kingdom curse all the people w...Trinity Kings World Leadership: Patillo Family Kingdom curse all the people w...
Trinity Kings World Leadership: Patillo Family Kingdom curse all the people w...
Terrell Patillo
 
Personal statement sept 12
Personal statement sept 12Personal statement sept 12
Personal statement sept 12
Jessica Cristina
 
L´heure Bleue
L´heure BleueL´heure Bleue
L´heure Bleue
Cachi Chien
 
Trinity Kings World Leadership: Government officials(Law enforcement), Allegh...
Trinity Kings World Leadership: Government officials(Law enforcement), Allegh...Trinity Kings World Leadership: Government officials(Law enforcement), Allegh...
Trinity Kings World Leadership: Government officials(Law enforcement), Allegh...
Terrell Patillo
 
Хто наживається на перевірці лічильників? Результати громадської експертизи
Хто наживається на перевірці лічильників? Результати громадської експертизиХто наживається на перевірці лічильників? Результати громадської експертизи
Хто наживається на перевірці лічильників? Результати громадської експертизи
Юрій Шеляженко
 
Christie reed using photoshop to enhance images
Christie reed  using photoshop to enhance imagesChristie reed  using photoshop to enhance images
Christie reed using photoshop to enhance images
christie94
 
Knossos slide show
Knossos slide showKnossos slide show
Knossos slide show
cthompson112398
 
Upute za izradu prezentacije
Upute za izradu prezentacijeUpute za izradu prezentacije
Upute za izradu prezentacije
dejanljub
 
Snow Art by Simon Beck
Snow Art by Simon BeckSnow Art by Simon Beck
Snow Art by Simon Beck
Cachi Chien
 
Feathers in a Cage (Part 1 of 2)
Feathers in a Cage (Part 1 of 2)Feathers in a Cage (Part 1 of 2)
Feathers in a Cage (Part 1 of 2)
Cachi Chien
 
How big is your Referral Gap - final
How big is your Referral Gap - finalHow big is your Referral Gap - final
How big is your Referral Gap - final
Customer Return
 
Polynesiaview
PolynesiaviewPolynesiaview
Polynesiaview
Wayne Jackson
 
Bs blue ocean strategy
Bs blue ocean strategyBs blue ocean strategy
Bs blue ocean strategy
Jorge Lopez RamonyCajal
 
SmartDecision Whitepaper
SmartDecision WhitepaperSmartDecision Whitepaper
SmartDecision Whitepaper
Lubov Putsko
 
Lenguaje corporal. Body language.
Lenguaje corporal. Body language.Lenguaje corporal. Body language.
Lenguaje corporal. Body language.
Cachi Chien
 
Trinity Kings World Leadership: Patillo Family Kingdom curse all the people w...
Trinity Kings World Leadership: Patillo Family Kingdom curse all the people w...Trinity Kings World Leadership: Patillo Family Kingdom curse all the people w...
Trinity Kings World Leadership: Patillo Family Kingdom curse all the people w...
Terrell Patillo
 
Personal statement sept 12
Personal statement sept 12Personal statement sept 12
Personal statement sept 12
Jessica Cristina
 
Trinity Kings World Leadership: Government officials(Law enforcement), Allegh...
Trinity Kings World Leadership: Government officials(Law enforcement), Allegh...Trinity Kings World Leadership: Government officials(Law enforcement), Allegh...
Trinity Kings World Leadership: Government officials(Law enforcement), Allegh...
Terrell Patillo
 
Хто наживається на перевірці лічильників? Результати громадської експертизи
Хто наживається на перевірці лічильників? Результати громадської експертизиХто наживається на перевірці лічильників? Результати громадської експертизи
Хто наживається на перевірці лічильників? Результати громадської експертизи
Юрій Шеляженко
 
Christie reed using photoshop to enhance images
Christie reed  using photoshop to enhance imagesChristie reed  using photoshop to enhance images
Christie reed using photoshop to enhance images
christie94
 
Upute za izradu prezentacije
Upute za izradu prezentacijeUpute za izradu prezentacije
Upute za izradu prezentacije
dejanljub
 
Snow Art by Simon Beck
Snow Art by Simon BeckSnow Art by Simon Beck
Snow Art by Simon Beck
Cachi Chien
 
Feathers in a Cage (Part 1 of 2)
Feathers in a Cage (Part 1 of 2)Feathers in a Cage (Part 1 of 2)
Feathers in a Cage (Part 1 of 2)
Cachi Chien
 
How big is your Referral Gap - final
How big is your Referral Gap - finalHow big is your Referral Gap - final
How big is your Referral Gap - final
Customer Return
 
Ad

Similar to JavaOne 2013 - Clojure for Java Developers (20)

Clojure night
Clojure nightClojure night
Clojure night
Aria Haghighi
 
Distributed Data Structures
Distributed Data StructuresDistributed Data Structures
Distributed Data Structures
PDX Web & Design
 
Slides changes symfony23
Slides changes symfony23Slides changes symfony23
Slides changes symfony23
Javier López
 
იოსებ ძმანაშვილი Node.js
იოსებ ძმანაშვილი   Node.jsიოსებ ძმანაშვილი   Node.js
იოსებ ძმანაშვილი Node.js
unihack
 
An introduction to Erlang and Elixir
An introduction to Erlang and ElixirAn introduction to Erlang and Elixir
An introduction to Erlang and Elixir
ericbmerritt
 
Programación funcional con haskell
Programación funcional con haskellProgramación funcional con haskell
Programación funcional con haskell
Agustin Ramos
 
Scala: Simplifying Development
Scala: Simplifying DevelopmentScala: Simplifying Development
Scala: Simplifying Development
mircodotta
 
Java 8 to the rescue!?
Java 8 to the rescue!?Java 8 to the rescue!?
Java 8 to the rescue!?
Fredrik Vraalsen
 
JavaZone 2013 - Datomic vs EventStore
JavaZone 2013 - Datomic vs EventStoreJavaZone 2013 - Datomic vs EventStore
JavaZone 2013 - Datomic vs EventStore
Jan Kronquist
 
The Not Java That's Not Scala
The Not Java That's Not ScalaThe Not Java That's Not Scala
The Not Java That's Not Scala
Justin Lee
 
The Shape of Functional Programming
The Shape of Functional ProgrammingThe Shape of Functional Programming
The Shape of Functional Programming
Mike Fogus
 
Scala 101
Scala 101Scala 101
Scala 101
Ignasi Marimon-Clos i Sunyol
 
University of arizona mobile matters - technology, a means to an end
University of arizona   mobile matters - technology, a means to an endUniversity of arizona   mobile matters - technology, a means to an end
University of arizona mobile matters - technology, a means to an end
Thibault Imbert
 
Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)
HamletDRC
 
And the Greatest of These Is ... Space
And the Greatest of These Is ... SpaceAnd the Greatest of These Is ... Space
And the Greatest of These Is ... Space
Ben Scofield
 
Securing Client Side Data
 Securing Client Side Data Securing Client Side Data
Securing Client Side Data
Grgur Grisogono
 
An introduction to Ember.js
An introduction to Ember.jsAn introduction to Ember.js
An introduction to Ember.js
codeofficer
 
Scala @ TomTom
Scala @ TomTomScala @ TomTom
Scala @ TomTom
Eric Bowman
 
The Future of JVM Languages
The Future of JVM Languages The Future of JVM Languages
The Future of JVM Languages
VictorSzoltysek
 
D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4
Jan Berdajs
 
Distributed Data Structures
Distributed Data StructuresDistributed Data Structures
Distributed Data Structures
PDX Web & Design
 
Slides changes symfony23
Slides changes symfony23Slides changes symfony23
Slides changes symfony23
Javier López
 
იოსებ ძმანაშვილი Node.js
იოსებ ძმანაშვილი   Node.jsიოსებ ძმანაშვილი   Node.js
იოსებ ძმანაშვილი Node.js
unihack
 
An introduction to Erlang and Elixir
An introduction to Erlang and ElixirAn introduction to Erlang and Elixir
An introduction to Erlang and Elixir
ericbmerritt
 
Programación funcional con haskell
Programación funcional con haskellProgramación funcional con haskell
Programación funcional con haskell
Agustin Ramos
 
Scala: Simplifying Development
Scala: Simplifying DevelopmentScala: Simplifying Development
Scala: Simplifying Development
mircodotta
 
JavaZone 2013 - Datomic vs EventStore
JavaZone 2013 - Datomic vs EventStoreJavaZone 2013 - Datomic vs EventStore
JavaZone 2013 - Datomic vs EventStore
Jan Kronquist
 
The Not Java That's Not Scala
The Not Java That's Not ScalaThe Not Java That's Not Scala
The Not Java That's Not Scala
Justin Lee
 
The Shape of Functional Programming
The Shape of Functional ProgrammingThe Shape of Functional Programming
The Shape of Functional Programming
Mike Fogus
 
University of arizona mobile matters - technology, a means to an end
University of arizona   mobile matters - technology, a means to an endUniversity of arizona   mobile matters - technology, a means to an end
University of arizona mobile matters - technology, a means to an end
Thibault Imbert
 
Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)
HamletDRC
 
And the Greatest of These Is ... Space
And the Greatest of These Is ... SpaceAnd the Greatest of These Is ... Space
And the Greatest of These Is ... Space
Ben Scofield
 
Securing Client Side Data
 Securing Client Side Data Securing Client Side Data
Securing Client Side Data
Grgur Grisogono
 
An introduction to Ember.js
An introduction to Ember.jsAn introduction to Ember.js
An introduction to Ember.js
codeofficer
 
The Future of JVM Languages
The Future of JVM Languages The Future of JVM Languages
The Future of JVM Languages
VictorSzoltysek
 
D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4
Jan Berdajs
 
Ad

Recently uploaded (20)

Improving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevExImproving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevEx
Justin Reock
 
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to KnowWhat is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
SMACT Works
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUEIntroduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdfvertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
Jasper Oosterveld
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptxISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
AyilurRamnath1
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
Edge AI and Vision Alliance
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
6th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 20256th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 2025
DanBrown980551
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Soulmaite review - Find Real AI soulmate review
Soulmaite review - Find Real AI soulmate reviewSoulmaite review - Find Real AI soulmate review
Soulmaite review - Find Real AI soulmate review
Soulmaite
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | BluebashMCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
Bluebash
 
Improving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevExImproving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevEx
Justin Reock
 
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to KnowWhat is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
What is Oracle EPM A Guide to Oracle EPM Cloud Everything You Need to Know
SMACT Works
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdfvertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
Jasper Oosterveld
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptxISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
AyilurRamnath1
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
Edge AI and Vision Alliance
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
6th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 20256th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 2025
DanBrown980551
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Soulmaite review - Find Real AI soulmate review
Soulmaite review - Find Real AI soulmate reviewSoulmaite review - Find Real AI soulmate review
Soulmaite review - Find Real AI soulmate review
Soulmaite
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | BluebashMCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
MCP vs A2A vs ACP: Choosing the Right Protocol | Bluebash
Bluebash
 

JavaOne 2013 - Clojure for Java Developers

  • 2. About me onsdag 25 september 13
  • 3. About me 1986 - Basic onsdag 25 september 13
  • 4. About me 1990 - 68K assembly 1986 - Basic onsdag 25 september 13
  • 5. About me 1990 - 68K assembly1986 - Basic 1995 - OOP onsdag 25 september 13
  • 6. 1997 - University About me 1990 - 68K assembly1986 - Basic 1995 - OOP onsdag 25 september 13
  • 7. 1997 - University About me 1990 - 68K assembly1986 - Basic 2005 - IoC,Aspects, Mixins 1995 - OOP onsdag 25 september 13
  • 8. 2008 - Functional 1997 - University About me 1990 - 68K assembly1986 - Basic 2005 - IoC,Aspects, Mixins 1995 - OOP onsdag 25 september 13
  • 9. 2012 - Lisp & dynamic typing 2008 - Functional 1997 - University About me 1990 - 68K assembly1986 - Basic 2005 - IoC,Aspects, Mixins 1995 - OOP onsdag 25 september 13
  • 10. This talk is not A comprehensive introduction to Clojure About idiomatic Clojure Another talk about functional programming onsdag 25 september 13
  • 11. Killer apps onsdag 25 september 13
  • 15. What is Clojure? Created 2007 by Rich Hickey Lisp Runs on JVM, CLR & JavaScript Design for concurrency onsdag 25 september 13
  • 16. Clojure example (defn divisible? [n d] (== 0 (mod n d))) (defn divides [n] (partial divisible? n)) (declare primes) (defn prime? [n] (not (some (divides n) (take-while #(< % n) primes)))) (def primes (lazy-cat [2 3 5] (filter prime? (drop 7 (range))))) onsdag 25 september 13
  • 17. Why Clojure? onsdag 25 september 13
  • 18. Why Clojure? Lisp - Code as data & Syntactic abstraction onsdag 25 september 13
  • 19. Why Clojure? Lisp - Code as data & Syntactic abstraction Functional - Declarative, Immutable onsdag 25 september 13
  • 20. Why Clojure? Lisp - Code as data & Syntactic abstraction Functional - Declarative, Immutable Interactive development environment onsdag 25 september 13
  • 21. Why Clojure? Lisp - Code as data & Syntactic abstraction Functional - Declarative, Immutable Interactive development environment Great eco-system - dynamic helps compatibility onsdag 25 september 13
  • 22. Why Clojure? Lisp - Code as data & Syntactic abstraction Functional - Declarative, Immutable Interactive development environment Great eco-system - dynamic helps compatibility Wrapper-free Java access onsdag 25 september 13
  • 23. Why Clojure? Lisp - Code as data & Syntactic abstraction Functional - Declarative, Immutable Interactive development environment Great eco-system - dynamic helps compatibility Wrapper-free Java access Less complexity onsdag 25 september 13
  • 25. Common complaints Lisp looks weird onsdag 25 september 13
  • 26. Common complaints Dynamic typing is scary Lisp looks weird onsdag 25 september 13
  • 27. Common complaints Dynamic typing is scary Lisp looks weird Just a toy language onsdag 25 september 13
  • 28. Common complaints Dynamic typing is scary Lisp looks weird Macros? Are you crazy? Just a toy language onsdag 25 september 13
  • 30. Clojure Atomic Data Types Arbitrary precision integers: 12345678987654 Doubles: 1.234 BigDecimals: 1.234M Ratios: 22/7 Strings: "fred" , Characters: a b c Symbols: fred ethel , Keywords: :fred :ethel Booleans: true false , Null: - nil Regex patterns #"a*b" Rich Hickey - Clojure for Java Programmers - http://www.youtube.com/watch?v=P76Vbsk_3J0 onsdag 25 september 13
  • 31. JavaScript Data Structures Arrays [1, 2, 3] ["fred", "ethel", "lucy"] Objects {name: "Jan Kronquist", age: 37} onsdag 25 september 13
  • 32. Clojure Data Structures Vectors [1, 2, 3] ["fred", "ethel", "lucy"] Maps {:name "Jan Kronquist", :age 37} move colon onsdag 25 september 13
  • 33. Clojure Data Structures Vectors [1 2 3] ["fred" "ethel" "lucy"] Maps {:name "Jan Kronquist" :age 37} commas are whitespace! onsdag 25 september 13
  • 34. Clojure Data Structures Vectors - indexed access [1 2 3] ["fred" "ethel" "lucy"] Maps {:name "Jan Kronquist" :age 37} Lists - singly linked (1 2 3 4 5) (fred ethel lucy) (list 1 2 3) Sets #{fred ethel lucy} onsdag 25 september 13
  • 35. Demo in REPL user=> "hello" "hello" user=> 5 5 user=> [1 2 3] [1 2 3] user=> qwe java.lang.RuntimeException: Unable to resolve symbol: qwe user=> (def qwe "hello world") #'user/qwe user=> qwe "hello world" onsdag 25 september 13
  • 36. "Hello world") The strangeness of Lisp println( onsdag 25 september 13
  • 37. "Hello world") The strangeness of Lisp println( onsdag 25 september 13
  • 38. "Hello world") The strangeness of Lisp println( (operator operand1 operand2 ...) Determines how the list is evaluated onsdag 25 september 13
  • 39. (= (.toString (+ 1 2)) "3") Example evaluation (= (.toString (+ 1 2)) "3") onsdag 25 september 13
  • 40. (= (.toString (+ 1 2)) "3") Example evaluation onsdag 25 september 13
  • 41. (= (.toString (+ 1 2)) "3") Example evaluation (= (.toString 3) "3") onsdag 25 september 13
  • 42. (= (.toString (+ 1 2)) "3") Example evaluation (= (.toString 3) "3") (= "3" "3") onsdag 25 september 13
  • 43. (= (.toString (+ 1 2)) "3") Example evaluation (= (.toString 3) "3") (= "3" "3") true onsdag 25 september 13
  • 45. int i = 5; (def i 5) OR (let [i 5] ...) if (x > 5) { return y; } else { return z; } (if (> x 5) y z) x * y * z (* x y z) foo(x, y, z) (foo x y z) object.method(x, y) (.method object x y) public String sayHello(String x) { return "Hello " + x; } (defn sayHello [x] (str "Hello " x)) onsdag 25 september 13
  • 46. int i = 5; (def i 5) OR (let [i 5] ...) if (x > 5) { return y; } else { return z; } (if (> x 5) y z) x * y * z (* x y z) foo(x, y, z) (foo x y z) object.method(x, y) (.method object x y) public String sayHello(String x) { return "Hello " + x; } (defn sayHello [x] (str "Hello " x)) onsdag 25 september 13
  • 47. int i = 5; (def i 5) OR (let [i 5] ...) if (x > 5) { return y; } else { return z; } (if (> x 5) y z) x * y * z (* x y z) foo(x, y, z) (foo x y z) object.method(x, y) (.method object x y) public String sayHello(String x) { return "Hello " + x; } (defn sayHello [x] (str "Hello " x)) onsdag 25 september 13
  • 48. int i = 5; (def i 5) OR (let [i 5] ...) if (x > 5) { return y; } else { return z; } (if (> x 5) y z) x * y * z (* x y z) foo(x, y, z) (foo x y z) object.method(x, y) (.method object x y) public String sayHello(String x) { return "Hello " + x; } (defn sayHello [x] (str "Hello " x)) onsdag 25 september 13
  • 49. int i = 5; (def i 5) OR (let [i 5] ...) if (x > 5) { return y; } else { return z; } (if (> x 5) y z) x * y * z (* x y z) foo(x, y, z) (foo x y z) object.method(x, y) (.method object x y) public String sayHello(String x) { return "Hello " + x; } (defn sayHello [x] (str "Hello " x)) onsdag 25 september 13
  • 50. int i = 5; (def i 5) OR (let [i 5] ...) if (x > 5) { return y; } else { return z; } (if (> x 5) y z) x * y * z (* x y z) foo(x, y, z) (foo x y z) object.method(x, y) (.method object x y) public String sayHello(String x) { return "Hello " + x; } (defn sayHello [x] (str "Hello " x)) onsdag 25 september 13
  • 51. Java Quiz public static void main(String[] args) { int bang = 1; do while (bang>=1) System.out.print(" bang is "+ bang); while (bang>1); } onsdag 25 september 13
  • 53. Working with Java classes (defn display [text] (let [frame (new JFrame "MyFrame")] (.add frame (new JLabel text)) (.setSize frame 300 200) (.setVisible frame true))) static void display(String text) { JFrame frame = new JFrame("MyFrame"); frame.add(new JLabel(text)); frame.setSize(300, 200); frame.setVisible(true); } onsdag 25 september 13
  • 54. Working with Java classes (defn display [text] (let [frame (new JFrame "MyFrame")] (.add frame (new JLabel text)) (.setSize frame 300 200) (.setVisible frame true))) static void display(String text) { JFrame frame = new JFrame("MyFrame"); frame.add(new JLabel(text)); frame.setSize(300, 200); frame.setVisible(true); } (display "Hello World") onsdag 25 september 13
  • 55. Working with Java classes (defn display [text] (let [frame (new JFrame "MyFrame")] (.add frame (new JLabel text)) (.setSize frame 300 200) (.setVisible frame true))) static void display(String text) { JFrame frame = new JFrame("MyFrame"); frame.add(new JLabel(text)); frame.setSize(300, 200); frame.setVisible(true); } a pattern! onsdag 25 september 13
  • 56. static void display(String text) { JFrame frame = new JFrame("MyFrame"); with (frame) { .add(new JLabel(text)); .setSize(300, 200); .setVisible(true); } } Working with Java classes (defn display [text] (let [frame (new JFrame "MyFrame")] (.add frame (new JLabel text)) (.setSize frame 300 200) (.setVisible frame true))) onsdag 25 september 13
  • 57. (defn display [text] (let [frame (new JFrame "MyFrame")] (doto frame (.add (new JLabel text)) (.setSize 300 200) (.setVisible true)))) Working with Java classes static void display(String text) { JFrame frame = new JFrame("MyFrame"); with (frame) { .add(new JLabel(text)); .setSize(300, 200); .setVisible(true); } } onsdag 25 september 13
  • 58. (defn display [text] (doto (new JFrame "MyFrame") (.add (new JLabel text)) (.setSize 300 200) (.setVisible true))) Working with Java classes static void display(String text) { JFrame frame = new JFrame("MyFrame"); frame.add(new JLabel(text)); frame.setSize(300, 200); frame.setVisible(true); } onsdag 25 september 13
  • 59. (defn display [text] (doto (new JFrame "MyFrame") (.add (new JLabel text)) (.setSize 300 200) (.setVisible true))) Working with Java classes static void display(String text) { JFrame frame = new JFrame("MyFrame"); frame.add(new JLabel(text)); frame.setSize(300, 200); frame.setVisible(true); } Ok, nice, but in practice you would never want something like this? onsdag 25 september 13
  • 60. static void write(String fileName, String text) throws IOException { try (Writer writer = new FileWriter(fileName)) { writer.write(text); } } Trust me, you want macros onsdag 25 september 13
  • 61. static void write(String fileName, String text) throws IOException { try (Writer writer = new FileWriter(fileName)) { writer.write(text); } } Trust me, you want macros (defn write [fileName text] (with-open [writer (new FileWriter fileName)] (.write writer text))) onsdag 25 september 13
  • 63. Structure in Modules - package Abstraction - interface Implementation - class onsdag 25 september 13
  • 64. Structure in Modules - package Abstraction - interface Implementation - class Problems mutable state? static methods? inheritance? constants? onsdag 25 september 13
  • 65. Structure in Modules namespace - first-class, dynamic, import, aliasing Abstraction defprotocol - can be added later Implementation defrecord - immutable, equals, hashcode, etc deftype - may mutate, only user functionilty reify - singleton gen-class & proxy - for Java interop onsdag 25 september 13
  • 66. Records - creating (ns my.namespace) (defrecord Person [firstName lastName]) (new Person "Jan" "Kronquist") onsdag 25 september 13
  • 67. Records - creating ; #my.namespace.Person{:firstName "Jan", :lastName "Kronquist"} (ns my.namespace) (defrecord Person [firstName lastName]) (new Person "Jan" "Kronquist") onsdag 25 september 13
  • 68. Records - field access ; #my.namespace.Person{:firstName "Jan", :lastName "Kronquist"} (ns my.namespace) (defrecord Person [firstName lastName]) (new Person "Jan" "Kronquist") (def person (new Person "Jan" "Kronquist")) (.firstName person) onsdag 25 september 13
  • 69. Records - field access ; #my.namespace.Person{:firstName "Jan", :lastName "Kronquist"} (ns my.namespace) (defrecord Person [firstName lastName]) (new Person "Jan" "Kronquist") (def person (new Person "Jan" "Kronquist")) (.firstName person) ; "Jan" onsdag 25 september 13
  • 70. Records - named parameters ; #my.namespace.Person{:firstName "Jan", :lastName "Kronquist"} (ns my.namespace) (defrecord Person [firstName lastName]) (new Person "Jan" "Kronquist") (def person (new Person "Jan" "Kronquist")) (.firstName person) ; "Jan" (map->Person {:lastName "Kronquist" :firstName "Jan"}) onsdag 25 september 13
  • 71. Records - named parameters ; #my.namespace.Person{:firstName "Jan", :lastName "Kronquist"} (ns my.namespace) (defrecord Person [firstName lastName]) (new Person "Jan" "Kronquist") (def person (new Person "Jan" "Kronquist")) (.firstName person) ; "Jan" (map->Person {:lastName "Kronquist" :firstName "Jan"}) ; #my.namespace.Person{:firstName "Jan", :lastName "Kronquist"} onsdag 25 september 13
  • 72. Records and protocols (defprotocol Nameable (getName [this])) onsdag 25 september 13
  • 73. Records and protocols (defprotocol Nameable (getName [this])) (defrecord Person [firstName lastName] Nameable (getName [this] (str firstName " " lastName))) (getName (new Person "Jan" "Kronquist")) ; "Jan Kronquist" Person class implements Nameable interface onsdag 25 september 13
  • 74. Records and protocols (defprotocol Nameable (getName [this])) (defrecord Person [firstName lastName]) (extend-protocol Nameable Person (getName [this] (str (.firstName this) " " (.lastName this)))) (getName (new Person "Jan" "Kronquist")) ; "Jan Kronquist" (defrecord Person [firstName lastName] Nameable (getName [this] (str firstName " " lastName))) (getName (new Person "Jan" "Kronquist")) ; "Jan Kronquist" Person class implements Nameable interface Person extended by Nameable after definition! onsdag 25 september 13
  • 75. Records and protocols (defprotocol Nameable (getName [this])) (defrecord Person [firstName lastName]) (extend-protocol Nameable Person (getName [this] (str (.firstName this) " " (.lastName this)))) (getName (new Person "Jan" "Kronquist")) ; "Jan Kronquist" (defrecord Person [firstName lastName] Nameable (getName [this] (str firstName " " lastName))) (.getName (new Person "Jan" "Kronquist")) ; "Jan Kronquist" Method getName exists on Person class onsdag 25 september 13
  • 76. Records and protocols (defprotocol Nameable (getName [this])) (defrecord Person [firstName lastName]) (extend-protocol Nameable Person (getName [this] (str (.firstName this) " " (.lastName this)))) (.getName (new Person "Jan" "Kronquist")) ; IllegalArgumentException No matching field found: getName (defrecord Person [firstName lastName] Nameable (getName [this] (str firstName " " lastName))) (.getName (new Person "Jan" "Kronquist")) ; "Jan Kronquist" Method getName exists on Person class But not in this case! onsdag 25 september 13
  • 77. Editors and IDEs? Eclipse - Counterclockwise IntelliJ - La Clojure Light Table Sublime Textmate Emacs onsdag 25 september 13
  • 78. Eclipse Counterclockwise ✓Restrictive formatting ✓Paren coloring ✓Typing suggestions ✓Being Eclipse https://code.google.com/p/counterclockwise/ onsdag 25 september 13
  • 80. Sublime ✓General purpose editor ✓Typing suggestions http://www.sublimetext.com/ onsdag 25 september 13
  • 82. Build tools Maven plugin Gradle plugin Leiningen onsdag 25 september 13
  • 83. Leiningen (defproject myproject "0.5.0-SNAPSHOT" :description "A project for doing things." :url "http://github.com/foo/bar" :dependencies [[org.clojure/clojure "1.5.1"] [ring/ring-core "1.2.0 "]] :plugins [[lein-ring "0.4.5"]]) onsdag 25 september 13
  • 84. Dynamic typing onsdag 25 september 13
  • 85. Dynamic typing? Robert Smallshire - The Unreasonable Effectiveness of Dynamic Typing for Practical Programs onsdag 25 september 13
  • 86. Dynamic typing is scary Compiler won’t find errors Limited tool support Performance? onsdag 25 september 13
  • 87. What made me think twice Web server onsdag 25 september 13
  • 88. What made me think twice Web server onsdag 25 september 13
  • 89. Clojure makes dynamic typing ok REPL Immutable data structure Pure functions Automated tests onsdag 25 september 13
  • 90. Dynamic typing and performance? Clojure is compiled to bytecode Generally good enough! onsdag 25 september 13
  • 91. Dynamic typing and performance? Clojure is compiled to bytecode Generally good enough! (defn len [^String x] (.length x)) onsdag 25 september 13
  • 92. Studies Stefan Hanenberg & Lutz Prechelt Dynamic is more productive No difference in reliability Robert Smallshire - 2 % defects are type errors (GitHub) onsdag 25 september 13
  • 94. Macros? Are you crazy? Dynamic typing is scary Convinced? Lisp looks weird Just a toy language onsdag 25 september 13
  • 95. Macros? Are you crazy? Dynamic typing is usable Convinced? Lisp looks weird Just a toy language REPL Immutable data structure Pure functions Automated tests onsdag 25 september 13
  • 96. Macros? Are you crazy? Lisp is consistent Dynamic typing is usable Convinced? Just a toy language REPL Immutable data structure Pure functions Automated tests (operation operand1 operand2 ...) onsdag 25 september 13
  • 97. Macros? Are you crazy? Lisp is consistent Dynamic typing is usable Convinced? REPL Immutable data structure Pure functions Automated tests Interesting language (operation operand1 operand2 ...) Namespaces Prototcols Records onsdag 25 september 13
  • 98. Macros? Are you crazy? Lisp is consistent Dynamic typing is usable Convinced? REPL Immutable data structure Pure functions Automated tests Interesting language (operation operand1 operand2 ...) Lazy seqs STM Functional Namespaces Prototcols Records onsdag 25 september 13
  • 99. Macros? Maybe....... Lisp is consistent Dynamic typing is usable Convinced? REPL Immutable data structure Pure functions Automated tests Interesting language (operation operand1 operand2 ...) Lazy seqs STM Functional Namespaces Prototcols Records try (Writer writer = new FileWriter(fileName)) writer.write(text); } onsdag 25 september 13
  • 100. Macros? Maybe....... Lisp is consistent Dynamic typing is usable Convinced? REPL Immutable data structure Pure functions Automated tests Interesting language (operation operand1 operand2 ...) Lazy seqs STM Functional Namespaces Prototcols Records try (Writer writer = new FileWriter(fileName)) writer.write(text); } DSL Reuse Structure onsdag 25 september 13