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
Introduction à Clojure
Search
Pablo Tamarit
October 30, 2012
Programming
98
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduction à Clojure
Pablo Tamarit
October 30, 2012
More Decks by Pablo Tamarit
See All by Pablo Tamarit
From Bash to Z shell in 5 min
ptamarit
1
92
Introduction to Clojure
ptamarit
0
81
Other Decks in Programming
See All in Programming
片田舎のおっさん、 Swift Buildのダイアモンド問題解決の不具合修正PRを出すが、解決方法がキャッシュをしないようにすることであり、ビルド時間が伸びると言われてマージされないので高速化もする/swiftbuild
yimajo
0
220
ソフトウェアエンジニアにとっての生成AI - 特性を知って使い倒す / generative ai for software enginner
kishida
7
2.1k
Flow は今どうなっているか
mizdra
PRO
0
660
プロポーザルを書いてもらう
pvcresin
0
570
How I Won Prize Money at a Hackathon Using Codex and Symphony Alpha
yasei_no_otoko
0
120
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
5
500
freee が目指す データ マネジメント戦略 AI-Ready 時代を支える 攻めのガバナンスとは
freee
PRO
0
450
Building a Meta Ray-Ban display app
akkeylab
0
170
メールのエイリアス機能を履き違えない
isshinfunada
0
250
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
1.6k
Dockerfile CMD for Node.js
grazie1999
0
110
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
4
1.7k
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
515
110k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.9k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Deep Space Network (abreviated)
tonyrice
0
260
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
260
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
BBQ
matthewcrist
89
10k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
250
How to Think Like a Performance Engineer
csswizardry
28
2.7k
So, you think you're a good person
axbom
PRO
2
2.1k
Practical Orchestrator
shlominoach
191
12k
Transcript
Introduction à Clojure Pablo Tamarit 30 octobre 2012 GenevaJUG
? 2000 2001 2002 2003 2004 2005 2006 2007 2008
2009 2010 2011 2012 1999 - 2005 EIG 2007 - 2049 CERN
(def panier [{:nom "pommes", :type :fruits} {:nom "poires", :type :fruits}
{:nom "scoubidous", :type :objets}]) (group-by :type panier) {:fruits [{:type :fruits, :nom "pommes"} {:type :fruits, :nom "poires"}], :objets [{:type :objets, :nom "scoubidous"}]} Avant-goût
• Partie philosophique • Partie théorique • Partie pratique
Partie philosophique
Clojure • Créé en 2007 • Simplicité • Pas d’orienté
objet! • Typage dynamique • Tout est immutable • Pas d'état • Pas d'effets de bord • Dialecte de Lisp! + λ
Lisp • Inventé en 1958
John McCarthy 1927 – 2011
Lisp • Inventé en 1958 • Lots of Irritating Superfluous
Parentheses?
Lisp • Inventé en 1958 • Lots of Irritating Superfluous
Parentheses • Homoiconicité • Macros paulgraham.com/avg.html
Partie théorique
Langage • Syntaxe simple, vocabulaire riche. – Syntaxe: données, fonctions
– Vocabulaire: fonctions clojure.org/cheatsheet
Syntaxe: collections Liste ("un" 2 3 3) Vecteur ["un" 2
3 3] Set #{"un" 2 3} Map {:nom "Pablo", :age 28} (:age {:nom "Pablo", :age 28}) 28
Syntaxe: fonctions Appel (+ 1 2 3) Définition (defn abs
[n] (if (neg? n) (- n) n)) Définition anonyme (fn [x y] (+ (abs x) (abs y))) Définition anonyme sucrée #(+ (abs %1) (abs %2)) condition then else vecteur liste fn args
Vocabulaire: fonctions (def coll [-42 5 -0.1]) (map abs coll)
(42 5 0.1) (reduce + 0 coll) -37.1 (filter neg? coll) (-42 -0.1)
Interop Java Clojure new JFrame("Titre") (JFrame. "Titre") Color.RED Color/RED frame.setTitle("Titre2")
(.setTitle frame "Titre2") frame.getTitle().toLowerCase() (.. frame getTitle toLowerCase) frame.add(panel) frame.pack() frame.setVisible(true) (doto frame (.add panel) (.pack) (.setVisible true)) 2 4 1 3
Partie pratique
Quoi installer? • Rien! <dependency> <groupId>org.clojure</groupId> <artifactId>clojure</artifactId> <version>1.4.0</version> </dependency> •
Qui a-t-il dans le JAR? – La librairie – REPL: java -jar clojure.jar – Compilateur: .clj .class
Outils • Build – leiningen – clojure-maven-plugin • IDE –
Counterclockwise (Eclipse) – La Clojure (IntelliJ IDEA) – Emacs!
Apprentissage • Présentations: – blip.tv/clojure – infoq.com/clojure • Livres: –
clojurebook.com – joyofclojure.com • Exercices: – 4clojure.com
Questions?
Crédits graphiques • Logo Clojure: © Tom Hickey (tomhickey.com) •
Vue aérienne du LHC: © 2001 CERN (cdsweb.cern.ch/record/42370) • La Trahison des images: © 1929 René Magritte • Duke models: © Sun Microsystems Inc. (duke.kenai.com/models) • Portrait de John McCarthy: © 2006 null0 (flic.kr/p/q39Sg) • L'Appel des cimes: © 1942 René Magritte • La Clairvoyance: © 1936 René Magritte • Cooled Beans: © 2008 Chris Bay (flic.kr/p/4z6CBA) • Gears: © Dima Yagnyuk (thenounproject.com/noun/gears/#icon- No2174, thenounproject.com/Deadtype) • Tools: © Jacob Hardbower (thenounproject.com/noun/tools/#icon- No4684, thenounproject.com/HeartWired)