Your SlideShare is downloading. ×

(Fun clojure)

904
views

Published on

My talk at Geek2Geek, where i gave little talk about first steps into Clojure.

My talk at Geek2Geek, where i gave little talk about first steps into Clojure.

Published in: Technology

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
904
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
16
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. (apply fun clojure) Geek<->Geek
  • 2. {:name “Timo Sulg” :from “VersionEye” :at “Geek2Geek” :twitter “@timgluz”}
  • 3. Path to Clojure
  • 4. Formal introduction
  • 5. Clojure
  • 6. Clojure philosophy source: “The Joy of Clojure”, M.Fogus
  • 7. Language basics
  • 8. Primitives integers 42, -107, 0x7f, 2r01011001, 32r3V floats 1.17, -2. , 366e7, 32e-14, 10.7e-3 rationals 22/2 , -7/22 , -103/4 symbols sym + def keywords :2 :chumby :? characters a space 0042 strings “this is string”
  • 9. Functions + inplace functions #(say %1) + anonymous functions (fn [x y] (+ x y)) + named-functions (def add2 (fn [x y] (+ x y))) (defn add2 (+ x y)) (defn addN ([] 0) ([x] x) ([x y] (+ x y)))) ;; function arity
  • 10. Seq(uence) “It is better to have 100 functions operate on one data structure than to have 10 function operate on 10 data structures”, Alan J. Perlis
  • 11. Clojure Collections + Lists (:yankee :hotel :foxtrot) + Vectors [1 :a 2 :b] (vector 1 2 4) (apply vector ‘(1 3 4)) + Hash-maps {1 :one, 2 :two 3 :three} + Sets #{:first :second :third}
  • 12. Loops high-order functions (map sqr [1 2 3]) (reduce + [1,2,3]) list comprehensions (for [word [“the” “quick” “tutorial”]] (format “<p>%s</p>” word)) recursion (defn print-down-from [x] (when (?pos x) (println x) (recur (dec x))))
  • 13. STM “STM - what, why, how” - http://sw1nn.com/blog/2012/04/11/clojure-stm-what-why-how/
  • 14. Mutation primitives and concurreny “Refs and transactions, STM” http://clojure.org/refs REF Agent Atom Var Coordinated ✓ Asynchronous ✓ Retriable ✓ ✓ Thread-local ✓
  • 15. Interoperability “Programming Clojure”, C.Emerick, p.44
  • 16. Bla-bla, it’s all here
  • 17. Little reality check
  • 18. Ugly side and why it’s okay. - clumzy lazyness - dynamic typing - microbenchmarks - exception vomit - young ecosystem - lack of good docs
  • 19. Vox Populi survey by Chas Emerick 3 most important graphs Results: http://java.dzone.com/articles/results-2012-state-clojure
  • 20. Quil - processing in Clojure
  • 21. Overtone - rock on REPL checkout: meta-ex.com
  • 22. Incanter - hammer your statistics
  • 23. Datomic
  • 24. Other Rockstars data processing (Storm, Cascalog, Incanter, Core.logic) data pipelining (Aleph, Plumbing, Core/async) Web (Hiccup, Ring, Dommy, Luminus, Pedestal) Graphs (d2, quil) Music (overtone, checkout meta-ex.com)
  • 25. Hands on REPL
  • 26. Installing lein 1. Download the lein script (or on Windows lein.bat) 2. Place it on your $PATH (eg. ~/bin) 3. Set it to be executable (chmod a+x ~/bin/lein)
  • 27. Editors Clooj / Catnip ps: there’s plugins for all mainstream IDEs
  • 28. Sample workflow > lein new geek2geek > cd & geek2geek > ls -a > vim project.clj > lein deps > lein repl
  • 29. tryClojure online REPL http://tryclj.com/ download Android App homebrew lein-try Shortcuts to Clojure
  • 30. Demos On REPL File IO API access Quil
  • 31. Demo 1 - FoxyEye
  • 32. Demo 1 - FoxyEye Experimental Firefox OS App Clojure ClojureScript
  • 33. Sources
  • 34. Books 1. “Clojure Programming” by Chas Emerick http://shop.oreilly.com/product/0636920013754.do 2. “Joy of Clojure”, by Micheal Fogus & Chris Houser http://shop.oreilly.com/product/0636920013754.do 3. Clojure Cookbook, by community http://clojure-cookbook.com/
  • 35. Websites quick ref: http://clojuredocs.org/quickref/Clojure%20Core Cheetsheet: http://clojure.org/cheatsheet Clojure page on VersionEye: http://versioneye.com/clojure Talks: http://www.youtube.com/user/clojuretv
  • 36. AFAIK Clojure Berlin’s meetup, 4th September: http: //www.meetup.com/Clojure- Berlin/events/123414852/ ClojureCup - end of September, http: //clojurecup.com/ EuroClojure - 14/15th October, http: //euroclojure.com/2013/
  • 37. Thank you!