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
Shantanu Kumar
February 28, 2016
Programming
0
440
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
510
Functional Composition with Dependency Injection (IN/Clojure 2016)
kumarshantanu
0
650
Performance optimization with Code as Data in Clojure
kumarshantanu
0
760
Production Clojure: An Experience Report
kumarshantanu
2
1.4k
Other Decks in Programming
See All in Programming
SEAL - Dive into the sea of search engines - Symfony Live Berlin 2025
alexanderschranz
1
130
RuboCop: Modularity and AST Insights
koic
1
220
データベースエンジニアの仕事を楽にする。PgAssistantの紹介
nnaka2992
9
4.5k
Memory API : Patterns, Performance et Cas d'Utilisation
josepaumard
0
130
Unlock the Potential of Swift Code Generation
rockname
0
250
Exit 8 for SwiftUI
ojun9
0
120
Chrome Extension Techniques from Hell
moznion
1
160
Amazon CloudWatchの地味だけど強力な機能紹介!
itotsum
0
130
The Weight of Data: Rethinking Cloud-Native Systems for the Age of AI
hollycummins
0
270
リアルタイムレイトレーシング + ニューラルレンダリング簡単紹介 / Real-Time Ray Tracing & Neural Rendering: A Quick Introduction (2025)
shocker_0x15
1
300
KawaiiLT 登壇資料 キャリアとモチベーション
hiiragi
0
110
Agentic Applications with Symfony
el_stoffel
2
280
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
227
22k
Writing Fast Ruby
sferik
628
61k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
5
540
The Pragmatic Product Professional
lauravandoore
33
6.5k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Navigating Team Friction
lara
184
15k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
We Have a Design System, Now What?
morganepeng
52
7.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
41
2.2k
Building Adaptive Systems
keathley
41
2.5k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
21k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
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