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
The design of Clojure
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Shantanu Kumar
February 28, 2016
Programming
0
470
The design of Clojure
An outline of how the Clojure programming language is designed to be used.
Shantanu Kumar
February 28, 2016
Tweet
Share
More Decks by Shantanu Kumar
See All by Shantanu Kumar
BRACT: A Minimal DRY Application Framework
kumarshantanu
1
540
Functional Composition with Dependency Injection (IN/Clojure 2016)
kumarshantanu
0
680
Performance optimization with Code as Data in Clojure
kumarshantanu
0
860
Production Clojure: An Experience Report
kumarshantanu
2
1.6k
Other Decks in Programming
See All in Programming
ご飯食べながらエージェントが開発できる。そう、Agentic Engineeringならね。
yokomachi
1
280
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
240
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
120
SourceGeneratorのマーカー属性問題について
htkym
0
120
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
230
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.1k
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
160
JPUG勉強会 OSSデータベースの内部構造を理解しよう
oga5
2
220
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
8
2.3k
CSC307 Lecture 15
javiergs
PRO
0
210
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
150
オブザーバビリティ駆動開発って実際どうなの?
yohfee
3
670
Featured
See All Featured
Thoughts on Productivity
jonyablonski
75
5.1k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Exploring anti-patterns in Rails
aemeredith
2
280
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.4k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
850
A Soul's Torment
seathinner
5
2.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
A Tale of Four Properties
chriscoyier
162
24k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
1.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Transcript
The Design of Clojure Shantanu Kumar, Concur 1
Who am I? • Engineer @ Concur • Author of
“Clojure High Performance Programming” • Open Source enthusiast: https://github.com/ kumarshantanu • @kumarshantanu on Twitter 2
Clojure • Created by Rich Hickey, 2007 • Eclipse Public
License (OSS) • Website — https://clojure.org/ • Lisp • Functional • Hosted on JVM (and CLR, JS) 3
Big ideas • Pervasive immutability (Epochal time model) • First-class
values • First-class functions • Performance • Host interoperability • First-class state management 4
–Stuart Halloway “Clojure feels like a general-purpose language beamed back
from the near future.” 5
Getting started with Clojure http://leiningen.org/ https://learnxinyminutes.com/docs/clojure/ http://www.braveclojure.com/ https://www.4clojure.com/ 6
Interactive REPL 7
Data types • Number: 42, -5.67, 22/7 • Boolean: true,
false • Character: \x, \y, \newline, \space • String: “foo”, “bar” (multi-line literals are supported) • Symbol: ‘do-something, ‘bizfn • Keyword: :red, :blue • Nothing: nil 8
Data structures • List: ‘(“Harry” 34 :male) — sequential access
• Map: {:name “Harry” :age 34} • Set: #{:red :blue} • Vector: [“Harry” 34 :male] 9
Working with data structures 10
Functions 11
Code is data 12
Persistent Data-structures • Immutable (updates return new instances) • Structure
sharing (Hash array mapped trie) • 32-way branching for O(<7) performance • Sustained performance across updates • Reference: “Ideal Hash Trees” (Phil Bagwell) 13
Working with collections 14
I want a loop! No automatic tail-call optimization 15
–Alan J Perlis “A language that doesn't affect the way
you think about programming, is not worth knowing.” 16
Records 17
Records • Class semantics (memory layout) • Behave as maps
• Immutable in the same way as maps 18
Protocols 19
Protocols • Behaviour contract • Polymorphism • Dispatch on target
object type • Used as implementation details 20
No structural inheritance! But, there are value hierarchies Image source:
https://xspblog.files.wordpress.com/2008/06/owl_yarly.jpg 21
Macros 22
Sample output 23
Macros • Compile-time code manipulation • Because code is data
24
Java interop 25
Concurrent execution • CPU-bound and I/O-bound thread pools • `future`:
Asynchronous one-time access • `pmap`: Concurrent CPU-bound processing • `promise/deliver`: Single producer-consumer • Java’s concurrent collections considered idiomatic 26
Concurrency and state • Atoms — uncoordinated compare and swap
• Agents — asynchronous sequential operations • Refs — Software Transactional Memory • Dynamic vars — Thread-local access 27
Thank you! @kumarshantanu 28