Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Clojure for Java Devs

Introduction to Clojure for Java Devs

Avatar for Peter Brachwitz

Peter Brachwitz

April 16, 2014
Tweet

More Decks by Peter Brachwitz

Other Decks in Programming

Transcript

  1. 4/16/2014 Clojure From A JVM Dev Perspective file:///Users/p_brc/src/clojure-via-java/presentation/index.html 1/10 Why

    Would You Want To Go From Java To Clojure? 1. Simpler, more elegant • Focus on the problem you are trying to solve not the ceremony around your implementation language 2. Dynamic, but good performance 3. Powerful extensibility 4. FP and concurrency features 1
  2. 4/16/2014 Clojure From A JVM Dev Perspective file:///Users/p_brc/src/clojure-via-java/presentation/index.html 2/10 What

    I Am Going To Show You Today 1. Entry points to get started with Clojure 2. Basic syntax for people coming from a C-style language 2
  3. 4/16/2014 Clojure From A JVM Dev Perspective file:///Users/p_brc/src/clojure-via-java/presentation/index.html 3/10 To

    Get a First Taste of Clojure 1. There are multiple web-based offerings • http://tryclj.com/ • http://clojurescriptkoans.com/ 2. No installation, no hassle 3. Get to know the basics 3
  4. 4/16/2014 Clojure From A JVM Dev Perspective file:///Users/p_brc/src/clojure-via-java/presentation/index.html 5/10 If

    You Want To Install It On Your Machine 1. You need Java. I assume you've got that already 2. Leiningen is the easiest way to get started 3. lein new your-new-app 5
  5. 4/16/2014 Clojure From A JVM Dev Perspective file:///Users/p_brc/src/clojure-via-java/presentation/index.html 9/10 Java

    Clojure int i = 5 (def i 5) if(x == 0) return y else return z (cond (zero? x) y z) x * y * z (* x y z) foo(x, y, z) (foo x y z) foo.bar(x) (. foo bar x) 9
  6. 4/16/2014 Clojure From A JVM Dev Perspective file:///Users/p_brc/src/clojure-via-java/presentation/index.html 10/10 Sources:

    • Rich Hickey: Clojure. An Introduction for Java Programmers. (YouTube) • Michael Fogus/Chris Houser: The Joy of Clojure. Manning 2014 (MEAP) • Luke VanderHart, Ryan Neufeld: Clojure Cookbook. O'Reilly 2014 10