Upcoming SlideShare
×

(Fun clojure)

1,034
-1

Published on

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

Published in: Technology
4 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
1,034
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
17
0
Likes
4
Embeds 0
No embeds

No notes for slide

(Fun clojure)

1. 1. (apply fun clojure) Geek<->Geek
2. 2. {:name “Timo Sulg” :from “VersionEye” :at “Geek2Geek” :twitter “@timgluz”}
3. 3. Path to Clojure
4. 4. Formal introduction
5. 5. Clojure
6. 6. Clojure philosophy source: “The Joy of Clojure”, M.Fogus
7. 7. Language basics
8. 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. 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. 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. 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. 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. 13. STM “STM - what, why, how” - http://sw1nn.com/blog/2012/04/11/clojure-stm-what-why-how/
14. 14. Mutation primitives and concurreny “Refs and transactions, STM” http://clojure.org/refs REF Agent Atom Var Coordinated ✓ Asynchronous ✓ Retriable ✓ ✓ Thread-local ✓
15. 15. Interoperability “Programming Clojure”, C.Emerick, p.44
16. 16. Bla-bla, it’s all here
17. 17. Little reality check
18. 18. Ugly side and why it’s okay. - clumzy lazyness - dynamic typing - microbenchmarks - exception vomit - young ecosystem - lack of good docs
19. 19. Vox Populi survey by Chas Emerick 3 most important graphs Results: http://java.dzone.com/articles/results-2012-state-clojure
20. 20. Quil - processing in Clojure
21. 21. Overtone - rock on REPL checkout: meta-ex.com
22. 22. Incanter - hammer your statistics
23. 23. Datomic
24. 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. 25. Hands on REPL
26. 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. 27. Editors Clooj / Catnip ps: there’s plugins for all mainstream IDEs
28. 28. Sample workflow > lein new geek2geek > cd & geek2geek > ls -a > vim project.clj > lein deps > lein repl
29. 29. tryClojure online REPL http://tryclj.com/ download Android App homebrew lein-try Shortcuts to Clojure
30. 30. Demos On REPL File IO API access Quil
31. 31. Demo 1 - FoxyEye
32. 32. Demo 1 - FoxyEye Experimental Firefox OS App Clojure ClojureScript
33. 33. Sources
34. 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. 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. 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. 37. Thank you!
1. Gostou de algum slide específico?

Recortar slides é uma maneira fácil de colecionar informações para acessar mais tarde.