SlideShare a Scribd company logo
1 of 14
Download to read offline
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

What's hot

Modern Compiler Design
Modern Compiler DesignModern Compiler Design
Modern Compiler Design
nextlib
 
Java generics past, present and future - Raoul-Gabriel Urma, Richard Warburton
Java generics past, present and future - Raoul-Gabriel Urma, Richard WarburtonJava generics past, present and future - Raoul-Gabriel Urma, Richard Warburton
Java generics past, present and future - Raoul-Gabriel Urma, Richard Warburton
JAXLondon_Conference
 
TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific Languages
Eelco Visser
 
Under the hood of scala implicits (kl10tch 10.03.2015)
Under the hood of scala implicits (kl10tch 10.03.2015)Under the hood of scala implicits (kl10tch 10.03.2015)
Under the hood of scala implicits (kl10tch 10.03.2015)
Alexander Podkhalyuzin
 

What's hot (18)

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

Similar to Introduction to clojure

Clojure - An Introduction for Java Programmers
Clojure - An Introduction for Java ProgrammersClojure - An Introduction for Java Programmers
Clojure - An Introduction for Java Programmers
elliando dias
 

Similar to Introduction to clojure (20)

Clojure
ClojureClojure
Clojure
 
Kotlin workshop 2018-06-11
Kotlin workshop 2018-06-11Kotlin workshop 2018-06-11
Kotlin workshop 2018-06-11
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
 
Lua زبان برنامه نویسی
Lua زبان برنامه نویسی Lua زبان برنامه نویسی
Lua زبان برنامه نویسی
 
Introduction to functional programming, with Elixir
Introduction to functional programming,  with ElixirIntroduction to functional programming,  with Elixir
Introduction to functional programming, with Elixir
 
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scala
 
Python for PHP developers
Python for PHP developersPython for PHP developers
Python for PHP developers
 
Sharable of qualities of clean code
Sharable of qualities of clean codeSharable of qualities of clean code
Sharable of qualities of clean code
 
Rohan Sharma MOOC Course Report (1).pptx
Rohan Sharma MOOC Course Report (1).pptxRohan Sharma MOOC Course Report (1).pptx
Rohan Sharma MOOC Course Report (1).pptx
 
Introduction to Go programming language
Introduction to Go programming languageIntroduction to Go programming language
Introduction to Go programming language
 
Dart workshop
Dart workshopDart workshop
Dart workshop
 
Python assignment help from professional programmers
Python assignment help from professional programmersPython assignment help from professional programmers
Python assignment help from professional programmers
 
Clojure intro
Clojure introClojure intro
Clojure intro
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
c
cc
c
 
Clojure - An Introduction for Java Programmers
Clojure - An Introduction for Java ProgrammersClojure - An Introduction for Java Programmers
Clojure - An Introduction for Java Programmers
 
Clojure presentation
Clojure presentationClojure presentation
Clojure presentation
 
Clojure - LISP on the JVM
Clojure - LISP on the JVM Clojure - LISP on the JVM
Clojure - LISP on the JVM
 
GDSC Web Bootcamp - Day - 2 - JavaScript
GDSC Web Bootcamp -  Day - 2   - JavaScriptGDSC Web Bootcamp -  Day - 2   - JavaScript
GDSC Web Bootcamp - Day - 2 - JavaScript
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Introduction to clojure

  • 1. Introduction to Clojure By Abhishek Mahawar BM Tech Talk
  • 2. 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).
  • 3. Clojure is a …. ● LISP dialect targeting the JVM ● Dynamic programming language ● Functional programming language ● Compiled language
  • 4. Clojure is a LISP ● S-expressions (Polish notation) (+ 2 4) ● Homoiconicity code is data, data is code ● Reader Operator/function names Arguments
  • 5. 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
  • 6. Data Structures ● Lists (1 2 3) ● Vectors [1 2 3] ● Maps {:a 1 :b 2} maps are functions of their keys ● Sets #{1 2}
  • 7. Data Structures (contd.) ● Clojure data structures are ○ persistent ■ previous version remains intact when modified ○ immutable ○ support proper equality semantics in their implementation of equals
  • 8. 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
  • 10. 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
  • 11. 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
  • 12. 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
  • 13. Lots of other stuff ● Software Transactional Memory ● Macros ● Lazy Sequences ● Metadatas
  • 14. References ● http://clojure.org/ ● http://www.youtube.com/clojuretv ● Clojure Programming by Chas Emerick, Brian Carper and Christophe Grand