Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
The design of Clojure
Search
Shantanu Kumar
February 28, 2016
Programming
510
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
The design of Clojure
An outline of how the Clojure programming language is designed to be used.
Shantanu Kumar
February 28, 2016
More Decks by Shantanu Kumar
See All by Shantanu Kumar
BRACT: A Minimal DRY Application Framework
kumarshantanu
1
580
Functional Composition with Dependency Injection (IN/Clojure 2016)
kumarshantanu
0
730
Performance optimization with Code as Data in Clojure
kumarshantanu
0
940
Production Clojure: An Experience Report
kumarshantanu
2
1.7k
Other Decks in Programming
See All in Programming
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
1.5k
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
290
Kotlinの15年とServer-Side Kotlin
n_takehata
1
190
Web3Dライブラリを作ってVue Custom Rendererの仕組みを理解しよう / lets learn vue custom renderer by making 3d library
drumath2237
1
120
No More NoSuchMethodError
exoego
1
120
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
280
SODA - FACT BOOK(EN)
sodainc
1
200
AmebaブログはKMPから卒業します
kmars0605
0
310
Engineering Biometric UX Across Android Versions | DroidKnights 2026
ryunen344
1
160
Vue.jsで作る空間解析アプリとCapacitorプラグインのData Bridge
hal_spidernight
1
160
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
120
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
460
Featured
See All Featured
The untapped power of vector embeddings
frankvandijk
2
2k
A Soul's Torment
seathinner
8
3.9k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
Making Projects Easy
brettharned
120
6.8k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.2k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
360
Side Projects
sachag
456
43k
A better future with KSS
kneath
240
18k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
470
Technical Leadership for Architectural Decision Making
baasie
3
630
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
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