SlideShare a Scribd company logo
Clojure: from ground up
R君
Agenda
• Lisp & Clojure intro (GC, FP, immutable)
• macro
• application
Clojure
Yet Another JVM Programming Language, a Lisp dialect.
(defn concat [xs ys]!
(if (empty? xs)!
ys!
(let [[h & t] xs]!
(cons h (concat t ys)))))
Lots of Irritating Stupid Parentheses
(defn concat [xs ys]!
(if (empty? xs)!
ys!
(let [[h & t] xs]!
(cons h (concat t ys)))))
LISt Processing
S-expression
http://norvig.com/lispy.html
GC
mark compact
GC
mark and sweep
http://atlas.cs.virginia.edu/~weimer/2008-415/reading/bacon-garbage.pdf
Functional Programming
• function as first-class citizen
• work by arguments and returning value
(defn make-adder [base]
(let [ref (atom base)]
(fn [delta]
(swap! ref (partial + delta)))))
Immutable
m = new HashMap();
m.put(1, “a”);
m.put(2, “b”);
m = new PersistentHashMap();
m = m.assoc(1, “a”);
m = m.assoc(2, “b”);
macro
(defmacro when [pred & body]
`(if ~pred (do ~@body) nil))
(when (> x 2)
(* x 4))
(if (> x 2)
(* x 4)
nil)
macro
(gen-from-tpl "exception {ex} at {line}")
(defmacro gen-from-tpl
[tpl-str]
(let [partitions (re-partition #"{((?:w|-)+)}" tpl-str)
string-and-symbol (map (fn [{:keys [match? result]}]
(if match?
(-> result second symbol)
result))
partitions)]
`(str ~@string-and-symbol)))
(str "exception" ex "at" line)
application
• strom
• cascalog
• compojure
application
cascalog
(?- (stdout)
(<- [?word ?count]
(sentence :> ?line)
(tokenise :< ?line :> ?word)
(c/count :> ?count)))
SELECT word, COUNT(*)
FROM words
GROUP BY word
application
compojure
(defroutes user-routes
(POST “/login" [username password] users/login)
(GET "/user/:id" [id] users/get-by-id))
(context "/user/current" []
(GET "/" [] …)
(POST "/profile" [phone location] ...)
(GET "/posts" [text] ...)))
Why Clojure
Java interop
java.lang.Math/PI => 3.141592653589793
(.exists (java.io.File. "t1.clj")) => true
(.toUpperCase "foo") => "FOO"
Q & A
Thanks

More Related Content

PDF
Lisp 1.5 - Running history
PPTX
Lua. The Splendors and Miseries of Game Scripting
PPTX
PDF
Los Angeles R users group - July 12 2011 - Part 2
PDF
JSON's big problem android_taipei_201709
PDF
Corpora Generation for Grammatical Error Correction
PDF
Map Analytics in Starcraft II
 
PPTX
APMG juni 2014 - Regular Expression
Lisp 1.5 - Running history
Lua. The Splendors and Miseries of Game Scripting
Los Angeles R users group - July 12 2011 - Part 2
JSON's big problem android_taipei_201709
Corpora Generation for Grammatical Error Correction
Map Analytics in Starcraft II
 
APMG juni 2014 - Regular Expression

What's hot (18)

PDF
Year when lambda functions were introduced in various languages
PDF
流行るLisp用Webフレームワーク(Gauche on Railsから学んだ事)
PPTX
A Very Brief Intro to Golang
PPT
Clojure
PDF
Map Analytics in Starcraft II
 
PDF
In The Land Of Graphs...
PDF
関数プログラマから見たPythonと機械学習
PDF
PDF
How my visualization tools use little memory: A tale of incrementalization an...
PDF
Functional Music Composition
PPTX
AWS and Terraform for Disaster Recovery
PDF
JavaScriptとLisp
PDF
Function + Action = Interaction (2015)
PPTX
La R Users Group Survey Of R Graphics
PDF
Duality of laplace transform
PDF
Jan Pustelnik - Curry-Howard w praktyce
PPTX
Java. Есть ли свет в конце тоннеля
PPTX
Cobol, lisp, and python
Year when lambda functions were introduced in various languages
流行るLisp用Webフレームワーク(Gauche on Railsから学んだ事)
A Very Brief Intro to Golang
Clojure
Map Analytics in Starcraft II
 
In The Land Of Graphs...
関数プログラマから見たPythonと機械学習
How my visualization tools use little memory: A tale of incrementalization an...
Functional Music Composition
AWS and Terraform for Disaster Recovery
JavaScriptとLisp
Function + Action = Interaction (2015)
La R Users Group Survey Of R Graphics
Duality of laplace transform
Jan Pustelnik - Curry-Howard w praktyce
Java. Есть ли свет в конце тоннеля
Cobol, lisp, and python
Ad

Viewers also liked (20)

PDF
A Dive Into Clojure
PDF
Writing Macros
PDF
不自然なcar/ナチュラルにconsして
PDF
Clojure Macros Workshop: LambdaJam 2013 / CUFP 2013
PPT
A little exercise with clojure macro
ODP
Clojure: Practical functional approach on JVM
PDF
Patterns
PDF
入門ClojureScript
PDF
Macros in Clojure
PDF
Continuation Passing Style and Macros in Clojure - Jan 2012
PPTX
Clojure的魅力
PPTX
Clojure概览
PDF
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
PDF
Clojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
KEY
(map Clojure everyday-tasks)
KEY
PDF
Introduction to clojure
PDF
DSL in Clojure
PDF
プログラミング言語Clojureのニャンパスでの活用事例
PPTX
Final evaluation
A Dive Into Clojure
Writing Macros
不自然なcar/ナチュラルにconsして
Clojure Macros Workshop: LambdaJam 2013 / CUFP 2013
A little exercise with clojure macro
Clojure: Practical functional approach on JVM
Patterns
入門ClojureScript
Macros in Clojure
Continuation Passing Style and Macros in Clojure - Jan 2012
Clojure的魅力
Clojure概览
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
Clojureシンタックスハイライター開発から考えるこれからのlispに必要なもの
(map Clojure everyday-tasks)
Introduction to clojure
DSL in Clojure
プログラミング言語Clojureのニャンパスでの活用事例
Final evaluation
Ad

Similar to Clojure from ground up (20)

PPTX
Clojure 7-Languages
PDF
From Java To Clojure (English version)
PDF
Full Stack Clojure
PDF
Clojure class
PDF
Clojure
PPT
PDF
Learn a language : LISP
PDF
A Taste of Clojure
PDF
On Functional Programming - A Clojurian Perspective
ODP
Getting started with Clojure
KEY
Clojure Intro
KEY
Scala clojure techday_2011
ODP
Clojure
PDF
Introductory Clojure Presentation
ODP
Clojure made simple - Lightning talk
PDF
Pune Clojure Course Outline
PDF
Clojure (and some lisp) in 10 mins for OO developers
PDF
Clojure Small Intro
PDF
Brief intro to clojure
PDF
Clojure - A practical LISP for the JVM
Clojure 7-Languages
From Java To Clojure (English version)
Full Stack Clojure
Clojure class
Clojure
Learn a language : LISP
A Taste of Clojure
On Functional Programming - A Clojurian Perspective
Getting started with Clojure
Clojure Intro
Scala clojure techday_2011
Clojure
Introductory Clojure Presentation
Clojure made simple - Lightning talk
Pune Clojure Course Outline
Clojure (and some lisp) in 10 mins for OO developers
Clojure Small Intro
Brief intro to clojure
Clojure - A practical LISP for the JVM

Recently uploaded (20)

PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
System and Network Administration Chapter 2
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
L1 - Introduction to python Backend.pptx
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Odoo Companies in India – Driving Business Transformation.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Reimagine Home Health with the Power of Agentic AI​
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
How to Choose the Right IT Partner for Your Business in Malaysia
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Which alternative to Crystal Reports is best for small or large businesses.pdf
System and Network Administration Chapter 2
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
L1 - Introduction to python Backend.pptx
CHAPTER 2 - PM Management and IT Context
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Digital Systems & Binary Numbers (comprehensive )
2025 Textile ERP Trends: SAP, Odoo & Oracle
Lecture 3: Operating Systems Introduction to Computer Hardware Systems

Clojure from ground up