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
Short Tour Of Clojure
Search
Tamizhvendan S
May 23, 2020
Programming
0
220
Short Tour Of Clojure
Tamizhvendan S
May 23, 2020
Tweet
Share
More Decks by Tamizhvendan S
See All by Tamizhvendan S
Let's Talk About Ability
tamizhvendan
0
200
Building an E-Commerce Marketplace Middleware in Clojure
tamizhvendan
0
630
Deep Dive Into Pattern Matching & Destructuring
tamizhvendan
0
380
Demystifying Functional Programming
tamizhvendan
0
350
Concurrent programming with F#
tamizhvendan
2
310
Let's Create MiniSuave
tamizhvendan
0
160
Getting Started in Functional Programming using F#
tamizhvendan
1
210
Hack_n_Learn_Fsharp_Ajira
tamizhvendan
0
290
Rethinking "State Management" - TW Geeknight
tamizhvendan
1
570
Other Decks in Programming
See All in Programming
fs2-io を試してたらバグを見つけて直した話
chencmd
0
240
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
850
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
940
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
140
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
140
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
720
テストコード文化を0から作り、変化し続けた組織
kazatohiei
2
1.5k
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
190
テストコード書いてみませんか?
onopon
2
140
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
190
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Designing for Performance
lara
604
68k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Building Applications with DynamoDB
mza
91
6.1k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Faster Mobile Websites
deanohume
305
30k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
The Pragmatic Product Professional
lauravandoore
32
6.3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Transcript
Lead Consultant www.ajira.tech Tamizhvendan S Passionate, Pragmatic and Polyglot Programmer
https://www.demystifyfp.com tamizhvendan (short-tour (of (clojure)))
Credits: https://twitter.com/andreasdotorg/status/570190592610832384
None
None
Credits: https://github.com/tallesl/Rich-Hickey-fanclub Simple Made Easy Hammock Driven Development The Value
of Values Effective Programs
Credits: https://www.artsy.net/artwork/brian-kernighan-hello-world
Hello World in three languages printf("Hello, World!\n"); C System.out.println("Hello, World");
Java println("Hello, World") Scala
Hello World Requirements 1. A String Representation 2. Function/Method
function (argument) Function/Method Invocation
function (argument) Clojure’s way! (function argument)
Hello World in Clojure (println "Hello, World!")
(println "Hello, World!") function argument whitespace Clojure Syntax
Functions with multiple arguments printf("hello, %s\n", "World!"); C System.out.printf("Hello, %s\n",
"World!"); Java printf("Hello, %s\n", "World!") Scala
function (argument1, argument2) Function/Method Invocation
(function argument1, argument2) Clojure’s way! function (argument1, argument2)
(function argument1, argument2) (function argument1 argument2) optional Clojure’s way!
(function argument1 argument2 argument3 …) Clojure’s way!
Consistent Syntax 1. Adding the numbers one, two, three &
four 2. Converting an integer to a string 3. Concatenating two strings 4. Conditional Operator
Adding the numbers one, two, three & four 1 +
2 + 3 + 4 Converting an integer to a string String.valueOf(1) Concatenating two strings "Hello, ".concat("World!")
1 + 2 + 3 + 4 function function function
argument1 argument2 argument3 argument4 Infix Notation
method String.valueOf(1) ClassName argument invoke function Prefix Notation
method "Hello, ".concat("World!") Object argument invoke function Prefix Notation
argument2 true ? "truthy" : "falsy" argument1 separator function argument3
Conditional Operator
function argument2 argument4 argument1 argument3 (+ 1 2 3 4)
Clojure Syntax 1 + 2 + 3 + 4
(String/valueOf 1) function argument1 class name static method argument(s) to
the static method Clojure Syntax String.valueOf(1)
(. "Hello, " concat "World!") function argument1 argument2 argument3 instance
instance method argument(s) to the instance method special form Clojure Syntax "Hello, ".concat("World!")
(if true "truthy" "falsy") function argument1 argument2 argument3 boolean value
value1 value2 special form Clojure Syntax true ? "truthy" : "falsy"
Clojure Syntax
Clojure Form A structure that the Clojure compiler recognise.
Types of Clojure Forms Atomic Data Type - Literals "Hello,
World" 1 1.2 true nil \a :keyword symbol false
Types of Clojure Forms Collection - Literals [1 "2" 3]
'(1 1.2 1.5) {:one 1 :two 2 :three 3} #{1 2 3}
Types of Clojure Forms Expressions (function invocation) (println "Hello, World!")
(println "Hello," "World!") (+ 1 2 3 4) (String/valueOf 1) (. "Hello, " concat "World!")
Literals evaluate to itself user!=> "Hello, World" "Hello, World" user!=>
1 1
Expression always return a value user!=> (println "Hello, Clojure!") Hello,
Clojure! nil output of println function return value of println function
Forms can be nested (println "1 + 1 =" (+
1 1))
Clojure Evaluation Model (println "1 + 1 =" (+ 1
1)) left to right
Clojure Evaluation Model (println "1 + 1 =" (+ 1
1)) An expression begins with “(“
Clojure Evaluation Model (println "1 + 1 =" (+ 1
1)) function symbol println is a variadic function defined in the clojure.core namespace.
Clojure Evaluation Model (println "1 + 1 =" (+ 1
1)) argument1 string literal literals evaluate to itself
Clojure Evaluation Model (println "1 + 1 =" (+ 1
1)) An expression begins with “(“ argument2
Clojure Evaluation Model (println "1 + 1 =" (+ 1
1)) function symbol + is a variadic function defined in the clojure.core namespace.
Clojure Evaluation Model (println "1 + 1 =" (+ 1
1)) argument1 integer literal literals evaluate to itself
Clojure Evaluation Model (println "1 + 1 =" (+ 1
1)) argument2 integer literal literals evaluate to itself
Clojure Evaluation Model (println "1 + 1 =" (+ 1
1)) An expression ends with “)“
Clojure Evaluation Model (println "1 + 1 =" 2) All
expressions return a value
Clojure Evaluation Model (println "1 + 1 =" 2) An
expression ends with “)“
Clojure Evaluation Model (println "1 + 1 =" 2) user!=>
(println "1 + 1 =" (+ 1 1)) 1 + 1 = 2 nil output of println function return value of println function
Clojure Evaluation Model Deviations Special Forms if . def let
quote var fn loop recur Macros when condp -> ->> Macros are programs that write programs! try do
Summary f(x) translates to (f x) f(x, y) translates to
(f x y) o.m(x) translates to (. o m x) 1 + 2 + 3 + 4 translates to (+ 1 2 3 4) Prefix Notation
Demo!
Let’s start!