SlideShare una empresa de Scribd logo
1 de 13
Descargar para leer sin conexión
(why (and
  :functional-programming
  :clojure)
:matters)
Why Should You Listen?
To learn

● Why FP useful for us
● Why to learn a "useless" side language
● Why Clojure
Why functional programming
matters?




            Proposals?
Functional programming: What,
why?
● Simplicity: Limit state, side-effects
  ○ Referential transparency
  ○ Immutable persistent data structures
  ○ STM, agents etc.
  ○ => concurrency
● Higher abstractions, including
  ○ HOF: More reuse - compose behavior
  ○ Multimethods: Dispatch on any argument(s)
● Language maintains state (lex. scope, loop)
● Generic operations on generic data structs
● Key design question: What it does?
You may ask

     Why hasn't FP taken the world over yet?
But then we could also ask

 Why became OOP, available since Simula 67,
           only popular in 90s?
  (Even though Smalltalk is more OO than Java and C++ and available since
                                   '81.)




It takes time, money, opportunity, optimization, and luck for concepts to take
hold.
Why Clojure?
● It's different
   ○ Functional - new paradigm, back-port learnings
● It's Lisp - the most powerful language ever
   ○ Macros - infinite abstraction
   ○ Write the language fitting the domain first
● It runs on JVM
   ○ Reuse, interoperab., mature and available platform
● Designed for concurrency
Lisp is worth learning for the profound
enlightenment experience you will have when
you finally get it; that experience will make you
a better programmer for the rest of your days,
even if you never actually use Lisp itself a lot.

           Eric S. Raymond, "How to Become a Hacker"
Clojure: Basic Facts
●   Functional language for JVM (and .net, JS)
●   Dynamically-typed
●   Good Java interoperability
●   2006 started, 2009 v1.0, 2011 v1.3
●   A Lisp ('58) dialect
●   Emphasis on simplicity
●   Designed for concurrency
    ○ STM, agents, immutability, ...
● Flexible, extensible
● Support for objects
● Code <=> data
Clojure Syntax
(function arg1 arg2 ...)
   (list 1 2 3 4 5)
   (+ 1 2 3)
   (def square (fn [x] (* x x)))

Lists - and that's all!
● Well, nearly - also 13 'special forms' (def, if,
   let, fn, try, ..)
● Few data types: '(), [], #{}, {}
● Literals: 1, "str", :key, symbol
Example: SQL
(defentity person)

(dry-run
 (select person
   (where {:name "Bodil" :age [> 18]})
   (order :name :ASC)))




                                 By Bodil Stokke, github.com/bodil
Thank you!
Refs
● http://stackoverflow.
  com/questions/1786969/pitfalls-
  disadvantages-of-functional-programming
● http://c2.com/cgi/wiki?
  AdvantagesOfFunctionalProgramming
● http://c2.com/cgi/wiki?OoVsFunctional
● http://c2.com/cgi/wiki?FpVsOo
● http://c2.com/cgi/wiki?FunctionalModeling
● http://c2.com/cgi/wiki?
  ArchitectureAndFunctionalProgramming
● http://clojure.org/rationale

Más contenido relacionado

Similar a Why Functional Programming and Clojure - LightningTalk

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

Similar a Why Functional Programming and Clojure - LightningTalk (20)

HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript Developers
 
The Rise of Functional Programming
The Rise of Functional ProgrammingThe Rise of Functional Programming
The Rise of Functional Programming
 
Node.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first stepsNode.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first steps
 
Play with Elm!
Play with Elm!Play with Elm!
Play with Elm!
 
Introduction to Functional Programming with Clojure
Introduction to Functional Programming with ClojureIntroduction to Functional Programming with Clojure
Introduction to Functional Programming with Clojure
 
Clojure made-simple - John Stevenson
Clojure made-simple - John StevensonClojure made-simple - John Stevenson
Clojure made-simple - John Stevenson
 
Performance optimization techniques for Java code
Performance optimization techniques for Java codePerformance optimization techniques for Java code
Performance optimization techniques for Java code
 
Clojure - An Introduction for Lisp Programmers
Clojure - An Introduction for Lisp ProgrammersClojure - An Introduction for Lisp Programmers
Clojure - An Introduction for Lisp Programmers
 
Are High Level Programming Languages for Multicore and Safety Critical Conver...
Are High Level Programming Languages for Multicore and Safety Critical Conver...Are High Level Programming Languages for Multicore and Safety Critical Conver...
Are High Level Programming Languages for Multicore and Safety Critical Conver...
 
PL Lecture 01 - preliminaries
PL Lecture 01 - preliminariesPL Lecture 01 - preliminaries
PL Lecture 01 - preliminaries
 
My first FOSDEM experience
My first FOSDEM experienceMy first FOSDEM experience
My first FOSDEM experience
 
Teaching Functional Programming @ TCD - 11/2012
Teaching Functional Programming @ TCD - 11/2012Teaching Functional Programming @ TCD - 11/2012
Teaching Functional Programming @ TCD - 11/2012
 
Programming with Freedom & Joy
Programming with Freedom & JoyProgramming with Freedom & Joy
Programming with Freedom & Joy
 
Introduction to Clojure
Introduction to ClojureIntroduction to Clojure
Introduction to Clojure
 
Play with elm - Choucri fahed, Finstack - Lambadays
Play with elm - Choucri fahed, Finstack - LambadaysPlay with elm - Choucri fahed, Finstack - Lambadays
Play with elm - Choucri fahed, Finstack - Lambadays
 
Snakes on a plane - Ship your Python on enterprise machines
Snakes on a plane - Ship your Python on enterprise machinesSnakes on a plane - Ship your Python on enterprise machines
Snakes on a plane - Ship your Python on enterprise machines
 
Thinking Functionally
Thinking FunctionallyThinking Functionally
Thinking Functionally
 
PARADIGM IT.pptx
PARADIGM IT.pptxPARADIGM IT.pptx
PARADIGM IT.pptx
 
Clojure in real life 17.10.2014
Clojure in real life 17.10.2014Clojure in real life 17.10.2014
Clojure in real life 17.10.2014
 
Go fundamentals
Go fundamentalsGo fundamentals
Go fundamentals
 

Más de Jakub Holy

Más de Jakub Holy (6)

Dissolving Technical Debt on Agile Projects - Smidig 2012
Dissolving Technical Debt on Agile Projects - Smidig 2012Dissolving Technical Debt on Agile Projects - Smidig 2012
Dissolving Technical Debt on Agile Projects - Smidig 2012
 
Dealing With Legacy: The Real-World Experience
Dealing With Legacy: The Real-World ExperienceDealing With Legacy: The Real-World Experience
Dealing With Legacy: The Real-World Experience
 
Commit on day one thanks to vagrant & puppet!
Commit on day one thanks to vagrant & puppet!Commit on day one thanks to vagrant & puppet!
Commit on day one thanks to vagrant & puppet!
 
Specification by example - course summary
Specification by example - course summarySpecification by example - course summary
Specification by example - course summary
 
Brief introduction into DbUnit Express, Q3/2011
Brief introduction into DbUnit Express, Q3/2011Brief introduction into DbUnit Express, Q3/2011
Brief introduction into DbUnit Express, Q3/2011
 
Seminar Nastroje Jednotk Testovani
Seminar Nastroje Jednotk TestovaniSeminar Nastroje Jednotk Testovani
Seminar Nastroje Jednotk Testovani
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Why Functional Programming and Clojure - LightningTalk

  • 1. (why (and :functional-programming :clojure) :matters)
  • 2. Why Should You Listen? To learn ● Why FP useful for us ● Why to learn a "useless" side language ● Why Clojure
  • 4. Functional programming: What, why? ● Simplicity: Limit state, side-effects ○ Referential transparency ○ Immutable persistent data structures ○ STM, agents etc. ○ => concurrency ● Higher abstractions, including ○ HOF: More reuse - compose behavior ○ Multimethods: Dispatch on any argument(s) ● Language maintains state (lex. scope, loop) ● Generic operations on generic data structs ● Key design question: What it does?
  • 5. You may ask Why hasn't FP taken the world over yet?
  • 6. But then we could also ask Why became OOP, available since Simula 67, only popular in 90s? (Even though Smalltalk is more OO than Java and C++ and available since '81.) It takes time, money, opportunity, optimization, and luck for concepts to take hold.
  • 7. Why Clojure? ● It's different ○ Functional - new paradigm, back-port learnings ● It's Lisp - the most powerful language ever ○ Macros - infinite abstraction ○ Write the language fitting the domain first ● It runs on JVM ○ Reuse, interoperab., mature and available platform ● Designed for concurrency
  • 8. Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot. Eric S. Raymond, "How to Become a Hacker"
  • 9. Clojure: Basic Facts ● Functional language for JVM (and .net, JS) ● Dynamically-typed ● Good Java interoperability ● 2006 started, 2009 v1.0, 2011 v1.3 ● A Lisp ('58) dialect ● Emphasis on simplicity ● Designed for concurrency ○ STM, agents, immutability, ... ● Flexible, extensible ● Support for objects ● Code <=> data
  • 10. Clojure Syntax (function arg1 arg2 ...) (list 1 2 3 4 5) (+ 1 2 3) (def square (fn [x] (* x x))) Lists - and that's all! ● Well, nearly - also 13 'special forms' (def, if, let, fn, try, ..) ● Few data types: '(), [], #{}, {} ● Literals: 1, "str", :key, symbol
  • 11. Example: SQL (defentity person) (dry-run (select person (where {:name "Bodil" :age [> 18]}) (order :name :ASC))) By Bodil Stokke, github.com/bodil
  • 13. Refs ● http://stackoverflow. com/questions/1786969/pitfalls- disadvantages-of-functional-programming ● http://c2.com/cgi/wiki? AdvantagesOfFunctionalProgramming ● http://c2.com/cgi/wiki?OoVsFunctional ● http://c2.com/cgi/wiki?FpVsOo ● http://c2.com/cgi/wiki?FunctionalModeling ● http://c2.com/cgi/wiki? ArchitectureAndFunctionalProgramming ● http://clojure.org/rationale