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
190
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
54
Gulp.js
samflores
1
140
Por que Ruby?
samflores
1
140
Extendendo Ruby com C (& cartoons)
samflores
3
180
Sinatra
samflores
2
210
Other Decks in Programming
See All in Programming
Gunma.web #55
tinykitten
0
130
いまさら聞けない生成AI入門: 「生成AIを高速キャッチアップ」
soh9834
11
3.2k
AIエージェントを活用したアプリ開発手法の模索
kumamotone
1
730
Identifying and Analyzing Fake OSS with Malware - fukuoka.go#21
rhykw
0
520
requirements with math
moony
0
500
ニックトレイン登壇資料
ryotakurokawa
0
120
読もう! Android build ドキュメント
andpad
1
190
フロントエンドテストの育て方
quramy
8
2.1k
Windows版PHPのビルド手順とPHP 8.4における変更点
matsuo_atsushi
0
360
Kubernetesで実現できるPlatform Engineering の現在地
nwiizo
2
1.6k
Firebase Dynamic Linksの代替手段を自作する / Create your own Firebase Dynamic Links alternative
kubode
0
160
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
0
540
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
35
1.7k
Making the Leap to Tech Lead
cromwellryan
133
9.2k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
134
33k
Producing Creativity
orderedlist
PRO
344
40k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.5k
Thoughts on Productivity
jonyablonski
69
4.5k
What's in a price? How to price your products and services
michaelherold
244
12k
A Tale of Four Properties
chriscoyier
158
23k
Side Projects
sachag
452
42k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.3k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
12k
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
"me@mail.com"})) korma
ClojureScript core.typed datomic Clojars jetty http-kit …
Comunidade
clojure.org clojure-doc.org clojuredocs.org grimoire.arrdem.com #clojure FreeNode
(obrigado) @samflores