SlideShare a Scribd company logo
Introduction to Clojure
By Abhishek Mahawar
BM Tech Talk
Not so old History
● Created by Rich Hickey
● First version in 2008
● Origin of name - Wanted to involve c(c#), l
(lisp) and j(java).
Clojure is a ….
● LISP dialect targeting the JVM
● Dynamic programming language
● Functional programming language
● Compiled language
Clojure is a LISP
● S-expressions (Polish notation)
(+ 2 4)
● Homoiconicity
code is data, data is code
● Reader
Operator/function names Arguments
Atomic Data Types
● Arbitrary precision integers 123
● Doubles 1.23 , BigDecimals 1.23M
● Ratios 22/7
● Strings “bm” , Characters b
● Symbols bm , Keywords :bm
● Booleans true false, Null - nil
Data Structures
● Lists (1 2 3)
● Vectors [1 2 3]
● Maps {:a 1 :b 2}
maps are functions of their keys
● Sets #{1 2}
Data Structures (contd.)
● Clojure data structures are
○ persistent
■ previous version remains intact when modified
○ immutable
○ support proper equality semantics in their
implementation of equals
Syntax
● We’ve just seen it !!
● No text based syntax
● Data structures are the code
Homoiconicity
● Actually, syntax is in the interpretation of
data structures
Clojure Evaluation
Clojure
code
Reader
characters
evaluator/
compiler
data structures
JVM
Output
bytecode
Expressions
● Everything is an expression
● All data literals represent themselves,
except
○ symbols - looks for binding to value
○ lists - an operation form
■ (operation arguments)
■ operation can be special ops, macros or
functions
Special ops/forms
● Can have non-normal evaluation of
arguments
○ (def name value-expr)
○ (if test-expr then-expr else-expr)
■ conditional, evaluates only one of then/else
● fn, let, loop, recur, do, new, ., throw, try,
set!, quote, var, monitor-enter, monitor-
exit
Functions
● First class values
○ (def five 5)
○ (def add-1 (fn[x] (+ x 1)))
○ (add-1 five) = 6
● Higher order functions (HOF)
● fn special op is used to create functions
Lots of other stuff
● Software Transactional Memory
● Macros
● Lazy Sequences
● Metadatas
References
● http://clojure.org/
● http://www.youtube.com/clojuretv
● Clojure Programming by Chas Emerick,
Brian Carper and Christophe Grand

More Related Content

ODP
Datatype in JavaScript
PDF
Scala qq
PDF
Advanced PHP Simplified
PPTX
Object Oriented Programming - Inheritance
PDF
C++ Language Training Institute, Ghaziabad
ODP
Ayush oops
PPT
JavaScript Data Types
PDF
Ballerina philosophy
Datatype in JavaScript
Scala qq
Advanced PHP Simplified
Object Oriented Programming - Inheritance
C++ Language Training Institute, Ghaziabad
Ayush oops
JavaScript Data Types
Ballerina philosophy

What's hot (18)

PDF
Modern Programming Languages classification Poster
PPTX
An Intro to Scala for PHP Developers
PPT
Modern Compiler Design
PDF
[Question Paper] Object Oriented Programming with C++ (Old Course) [April / 2...
PDF
Introduction to Smalltalk
PPTX
Tarea final marleny parra
PDF
Smalltalk, the dynamic language
PDF
Software Developer Training
PDF
Core Java Programming Language (JSE) : Chapter III - Identifiers, Keywords, ...
PDF
Java generics past, present and future - Raoul-Gabriel Urma, Richard Warburton
PDF
Getting Fired with Java Types
PDF
Understanding Hadoop through examples
PPTX
Presentation1
PDF
TI1220 Lecture 14: Domain-Specific Languages
PDF
A Feature-Based Model for Nested Named-Entity Recognition at VLSP-2018 NER Ev...
PPSX
Structure
PDF
Under the hood of scala implicits (kl10tch 10.03.2015)
Modern Programming Languages classification Poster
An Intro to Scala for PHP Developers
Modern Compiler Design
[Question Paper] Object Oriented Programming with C++ (Old Course) [April / 2...
Introduction to Smalltalk
Tarea final marleny parra
Smalltalk, the dynamic language
Software Developer Training
Core Java Programming Language (JSE) : Chapter III - Identifiers, Keywords, ...
Java generics past, present and future - Raoul-Gabriel Urma, Richard Warburton
Getting Fired with Java Types
Understanding Hadoop through examples
Presentation1
TI1220 Lecture 14: Domain-Specific Languages
A Feature-Based Model for Nested Named-Entity Recognition at VLSP-2018 NER Ev...
Structure
Under the hood of scala implicits (kl10tch 10.03.2015)
Ad

Similar to Introduction to clojure (20)

PDF
Clojure
PDF
Kotlin workshop 2018-06-11
PDF
Dart the better Javascript 2015
PDF
Lua زبان برنامه نویسی
PPTX
Introduction to functional programming, with Elixir
PDF
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
PDF
Functional programming in Scala
PPTX
4. Tools Proyek Data Science DTS-TA v.3.pptx
PPTX
1P13 Python Review Session Covering various Topics
PDF
Python for PHP developers
PDF
Compiler_Design_Introduction_Unit_2_IIT.pdf
PDF
Sharable of qualities of clean code
PPTX
Rohan Sharma MOOC Course Report (1).pptx
PDF
Introduction to Go programming language
PDF
Dart workshop
PPTX
Python assignment help from professional programmers
PDF
Clojure intro
PDF
Functional programming
PPTX
PDF
Clojure - An Introduction for Java Programmers
Clojure
Kotlin workshop 2018-06-11
Dart the better Javascript 2015
Lua زبان برنامه نویسی
Introduction to functional programming, with Elixir
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
Functional programming in Scala
4. Tools Proyek Data Science DTS-TA v.3.pptx
1P13 Python Review Session Covering various Topics
Python for PHP developers
Compiler_Design_Introduction_Unit_2_IIT.pdf
Sharable of qualities of clean code
Rohan Sharma MOOC Course Report (1).pptx
Introduction to Go programming language
Dart workshop
Python assignment help from professional programmers
Clojure intro
Functional programming
Clojure - An Introduction for Java Programmers
Ad

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Cloud computing and distributed systems.
PDF
Electronic commerce courselecture one. Pdf
PPT
Teaching material agriculture food technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Spectroscopy.pptx food analysis technology
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Approach and Philosophy of On baking technology
PDF
cuic standard and advanced reporting.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Network Security Unit 5.pdf for BCA BBA.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectral efficient network and resource selection model in 5G networks
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
The AUB Centre for AI in Media Proposal.docx
Review of recent advances in non-invasive hemoglobin estimation
Machine learning based COVID-19 study performance prediction
Cloud computing and distributed systems.
Electronic commerce courselecture one. Pdf
Teaching material agriculture food technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Spectroscopy.pptx food analysis technology
MYSQL Presentation for SQL database connectivity
Approach and Philosophy of On baking technology
cuic standard and advanced reporting.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
The Rise and Fall of 3GPP – Time for a Sabbatical?
NewMind AI Weekly Chronicles - August'25 Week I
sap open course for s4hana steps from ECC to s4
Diabetes mellitus diagnosis method based random forest with bat algorithm
Network Security Unit 5.pdf for BCA BBA.

Introduction to clojure