Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Clojure
Search
Samuel Flores
November 29, 2014
Programming
4
200
Clojure
Apresentando Clojure hoje no encontro do GuruPI
Samuel Flores
November 29, 2014
Tweet
Share
More Decks by Samuel Flores
See All by Samuel Flores
Introdução ao MRuby
samflores
1
56
Gulp.js
samflores
1
150
Por que Ruby?
samflores
1
140
Extendendo Ruby com C (& cartoons)
samflores
3
180
Sinatra
samflores
2
220
Other Decks in Programming
See All in Programming
機械学習って何? 5分で解説頑張ってみる
kuroneko2828
0
210
Bytecode Manipulation 으로 생산성 높이기
bigstark
1
300
Javaのルールをねじ曲げろ!禁断の操作とその代償から学ぶメタプログラミング入門 / A Guide to Metaprogramming: Lessons from Forbidden Techniques and Their Price
nrslib
3
1.9k
複数アプリケーションを育てていくための共通化戦略
irof
10
3.8k
統一感のある Go コードを生成 AI の力で手にいれる
otakakot
0
3k
F#で自在につくる静的ブログサイト - 関数型まつり2025
pizzacat83
0
290
インターフェース設計のコツとツボ
togishima
2
710
XSLTで作るBrainfuck処理系
makki_d
0
190
セキュリティマネジャー廃止とクラウドネイティブ型サンドボックス活用
kazumura
1
170
Javaに鉄道指向プログラミング (Railway Oriented Pro gramming) のエッセンスを取り入れる/Bringing the Essence of Railway-Oriented Programming to Java
cocet33000
2
540
Parallel::Pipesの紹介
skaji
2
910
A comprehensive view of refactoring
marabesi
0
170
Featured
See All Featured
Optimizing for Happiness
mojombo
379
70k
Making Projects Easy
brettharned
116
6.2k
Building Adaptive Systems
keathley
43
2.6k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
900
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.5k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Code Review Best Practice
trishagee
68
18k
Optimising Largest Contentful Paint
csswizardry
37
3.3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
34k
A Tale of Four Properties
chriscoyier
159
23k
Transcript
(Clojure) @samflores
Lisp
Lots of InSignificant Parenthesis
LISt Processing
(1 2 3) *
Homoiconicidade
(+ 2 3) ; 5
(+ 2 4 6) ; 12
(doc +) clojure.core/+ ([] [x] [x y] [x y &
more]) Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See also: +'
Funcional
(odd? 2) ; false
(def par? (fn [n] (even? n))) (par? 2); true
(def par? even?) (par? 2); true
(defn greet [name] (str "Hello, " name)) (greet "John"); Hello,
John
(map :name [{:name "John" :age 15} {:name "Mary" :age 10}])
(reduce + (range 10))
(apply + (repeat 30 8)) ; 240
(def dobra (partial * 2)) (dobra 5) ; 10
Simplicidade
def fn #() if do let quote ‘() var #’()
loop recur throw try formas especiais
alias and BEGIN begin break case class def defined? do
else elsif END end ensure for if in module next not or redo rescue retry return self super then undef unless until when while yield Ruby
assert break class const continue default do double else enum
extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while Java
Pragmatismo
(def b 2r101010) (def n 1337N) (def m 3.14159M) (def
r #"(\d+)") data types
(def l '(1 2 3)) (def v [1 2 3])
(def m {:a 1 :b 2}) (def s #{:x :y :z}) data types
JVM*
(def today (java.Util.Date.)) (.year today) ; today.year() (Integer/parseInt "10") Java
interop
Imutabilidade*
(def l '(1)) (conj l 2) (prn l) ; (1)
& Concorrência Paralelismo
STM atoms agents delays futures promisses refs core.async …
(def l (atom [])) (swap! l conj 1) atoms
(def c (agent 0)) (send c inc) (send c dec)
(await c) agents
(defn long-running-job [n] (Thread/sleep 3000) (+ n 10)) (pmap long-running-job
(range 100)) pmap
(def ch (chan)) (go (print (<! ch))) (put! ch "Hi")
core.async
Environment
(defroute "/" [] (home-handler)) (defroute "/:user” [user] (profile-handler user)) compojure
:dependencies [[org.clojure/clojure "1.6.0"] [org.clojure/core.async "0.1.346.0-17112a-alpha"]] leiningen
$ lein deps $ lein ring server leiningen
(select user (with address) (fields :firstName :lastName :address.state) (where {:email
"
[email protected]
"})) korma
ClojureScript core.typed datomic Clojars jetty http-kit …
Comunidade
clojure.org clojure-doc.org clojuredocs.org grimoire.arrdem.com #clojure FreeNode
(obrigado) @samflores