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
Joy of Clojure
Search
John Biesnecker
March 02, 2012
Programming
600
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Joy of Clojure
A very brief introduction to Clojure delivered at Barcamp Shanghai on March 3, 2012.
John Biesnecker
March 02, 2012
More Decks by John Biesnecker
See All by John Biesnecker
Product Design for Chimps
biesnecker
0
130
Other Decks in Programming
See All in Programming
3Dシーンの圧縮
fadis
1
670
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.2k
GitHub Copilot CLIのいいところ
htkym
2
1.3k
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
500
OSもどきOS
arkw
0
460
AI駆動開発勉強会 広島支部 第一回勉強会 AI駆動開発概要とワークショップ
hayatoshimiu
0
450
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
440
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
360
Old Dog, New Tricks: The Java 25 Reinvention - JNation
bazlur_rahman
0
150
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
4.3k
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
140
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
650
Featured
See All Featured
The Language of Interfaces
destraynor
162
27k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
570
The Curious Case for Waylosing
cassininazir
1
380
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
290
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
A designer walks into a library…
pauljervisheath
211
24k
Accessibility Awareness
sabderemane
1
130
Building Applications with DynamoDB
mza
96
7.1k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
420
How to Talk to Developers About Accessibility
jct
2
220
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
600
The browser strikes back
jonoalderson
0
1.1k
Transcript
The Joy of Clojure Clojure之乐 John Biesnecker twitter: @biesnecker 新浪微博:
@岳撼 Barcamp Shanghai, 03 March 2012
Quick show of hands. Clojure junkies? LISP hackers? Functional Programming
aficionados? Java nerds? How many of you are ...
(= :clojure [:lisp :functional :jvm])
(= :clojure [:lisp :functional :jvm])
http://xkcd.com/297/
(= :data :code) (= :code :data) homoiconicity
(+ 1 2) ;; => 3
(eval (list (symbol “+”) 1 2)) ;; => 3
macros extend the language seamlessly
(defmacro unless [condition & body] `(if (not ~condition) (do ~@body)))
;; (unless (= true false) ;; (println “You don’t understand booleans, do you?”))
(= :clojure [:lisp :functional :jvm])
functional, but not pedantic about it (sorry Haskell... we can
still be friends though, right?)
immutable by default (with managed mutability when you need it)
easier to reason about
expressive
;; sum of multiples of 27 under one million (reduce
+ (filter #(zero? (mod % 27)) (range 0 1e6))) ;; 18518981481
composable (small pieces, loosely joined)
;; functions are first-class object (defn increment-by-three [x] (+ x
3)) (defn contrived-example [avector afunction] (map afunction avector) ;; (contrived-example [1 2 3] increment-by-three) ;; => (4 5 6)
;; anonymous functions are easy (defn contrived-example [avector afunction] (map
afunction avector) ;; (contrived-example [1 2 3] #(+ % 3)) ;; => (4 5 6)
(= :clojure [:lisp :functional :jvm])
(almost) seamless interop with Java
(BigInteger. “12345678900987654321”) ;; returns a java.math.BigInteger object
most new languages have poor library support
Clojure has every library ever written in Java
;; writing a high-performance thread-safe cache is hard (import ‘com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap)
(import ‘com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap$Builder) (-> (ConcurrentLinkedHashMap$Builder.) (.maximumWeightedCapacity 1000) (.build)) ;; thanks, Google ;-)
(= :clojure [:lisp :functional :jvm])
did I mention killer concurrency support?
questions?
谢谢 Thank you