SlideShare a Scribd company logo
Introducing Clojure as a powerful JVM language
  from a value-added perspective for those that
               already know Java.

                    a.k.a.

  “Okay, I know Java, why should I consider
                  Clojure?”
A little about me
●   Avram Aelony
●   My programming language evolution
●   Notes about evangelism
    ●   use the language you prefer “whenever,
        wherever...” like Shakira says
●   How I came to Clojure
Disclaimers
●   Standing on the shoulders of giants, luminaries
●   This is a HUGE topic
●   The Good news:
    ●   There are MUCH better (explained, comprehensive,
        deeper) talks on this topic than mine
    ●   I will reference them
    ●   Should you remain unconvinced by this talk, there
        are inumerable resources online that may be
        somewhat more convincing
Audience survey
●   Java ?
●   Clojure ?
●   Other functional language?
●   Other JVM language?
Utility
●   Why is Clojure useful if you know Java?
        ●   It adds to what you know
        ●   Provides simplicity, concision, more


    l
Grand tour
●   Idea is to go into the Rationale and introduce Clojure
    along the way

●   Mostly about the Why rather than the How
    ●   ... some How as well...
Preliminaries and Similarities




Source: "Clojure-Java Interop: A Better Java than Java"
http://www.infoq.com/presentations/Clojure-Java-Interop
Rationale



    "I wanted: A Lisp for Functional Programming
    symbiotic with an established Platform
    designed for Concurrency."

●


                         - Rich Hickey, creator of Clojure
                                http://clojure.org/rationale
Break down

1. A Lisp
2. for Functional Programming
3. symbiotic with an established platform
4. designed for Concurrency
Break down

1. A Lisp
2. for Functional Programming
3. symbiotic with an established platform
4. designed for Concurrency
A Lisp
●   Dynamic typing
●   Homoiconic: Uniform, elegant syntax
●   Expression oriented: Symbolic expressions
●   Lambda calculus: variable binding
●   Macros
●   Code as data
●   Data as code
Clojure Data Structures
●   Lists '( 1 2 3 4 )
    ●   new insertions go to the front
●   Vectors [ 1 2 3 4 ]
    ●   new insertions go to the back
●   Maps { :a 1 :b 2 :c 3 :d 4}
●   Sets #{ :a :b :c :d }
    ●   implemented as k/v where k=v.
Data Structures
Persistent Data Structures
Immutable Data
●   So how can things change?
    ●   New things can be created
    ●   Underlying structure is shared wherever possible
    ●   only connections change
Immutable Data + Structural Sharing




                                                                identical?
                                                                function that
                                                                returns true only
                                                                when symbols are
                                                                in fact the same
                                                                object.




             Phillip Potter http://skillsmatter.com/podcast/scala/persistent-data-structures-in-clojure
Collections Abstraction
●   Vectors, Maps, Sets can be thought of as Collections.
●   Most functions that work on one data structure will
    work on any other.
●   Easy to change from Vector to Map to Set with minimal
    refactoring of functions.
Sequences and Collections
●   seqs are persistent and immutable
●   seq function
●   lazyiness, lazy application
●   seq interface
Seqs
Homo-iconic
Homo = Same, Iconic = representation
Anonymous Function syntax
Fizz Buzz
Print the numbers from 1 to N
If a number is divisible by 3, print "Fizz" instead
If a number is divisible by 5, print "Buzz" instead
If a number is divisible by 3 and 5, print "FizzBuzz" instead
Fizz Buzz
S-Expressions, data as code




                       as seen in The Joy of Clojure
S-Expressions, data as code
●   John McCarthy
●   assign symbolic names to clojure data
●   trees of expressions, each of which returns a
    value
●   functions can be assigned to vars
●   def, fn, defn



                                  http://en.wikipedia.org/wiki/Symbolic_expression
Macros
●   Why Macros?
    ●   to arrange code differently
        –   Threading macros -> and ->>
        –   infix versus postfix
        –   dot and dot dot macros for Java interop
    ●   to remove or reduce boilerplate code
“The whole language is always available. There is no real distinction
between read-time, compile-time, and runtime. You can compile or run code
while reading, read or run code while compiling, and read or compile code at
runtime.”


“Running code at read-time lets users reprogram Lisp's syntax; running code
at compile-time is the basis of macros; compiling at runtime is the basis of
Lisp's use as an extension language in programs like Emacs; and reading at
runtime enables programs to communicate using s-expressions, an idea
recently reinvented as XML. “




                                               What Made Lisp Different
                                               http://www.paulgraham.com/diff.htm
Compilation
●   “Clojure compiles all code you load on-the-fly
    into JVM bytecode, but sometimes it is
    advantageous to compile ahead-of-time (AOT).”




                                   http://clojure.org/compilation
Code as Data
Code as data, Data as Code
Break down

1. A Lisp
2. for Functional Programming
3. symbiotic with an established platform
4. designed for Concurrency
Functional Programming
●   tools to avoid mutable state, data
●   referential transparency
●   functions are first class objects
●   emphasizes application of functions
●   emphasizes recursive iteration
●   encourages higher-order functions



       http://clojure.org/functional_programming
       http://en.wikipedia.org/wiki/Functional_programming
       http://en.wikipedia.org/wiki/Referential_transparency_%28computer_science%29
Referential Transparency
●   expressions can be replaced with their value without
    changing the behavior of the program
●   easier to reason about programs


    “... can help in proving correctness,
    simplifying an algorithm,
    assisting in modifying code without breaking it,
    or optimizing code by means of memoization,
    common subexpression elimination or parallelization.”
    -wikipedia
                             http://en.wikipedia.org/wiki/Referential_transparency_%28computer_science%29
Higher Order Functions
map is an example of a higher order function, since it
applies another function to a collection.




juxt is a higher order function that juxtaposes the values
that result from the application of one or more functions.
I know Java, why should I consider Clojure?
Not exactly what we want without
              map




  Higher order functions allow for great flexibility in re-shaping data.
Break down

1. A Lisp
2. for Functional Programming
3. symbiotic with an established platform
4. designed for Concurrency
JVM as host platform
●   Interop as built-in syntax
●   Java libraries easily used from Clojure
●   e.g. Hadoop, Apache libraries, anything in a
    Maven repo, etc..
Java Interop
                                     Clojure                                Java
Constructor                     (Widget. “foo”)                     new Widget(“foo”)
Instance members                 (.nextInt rnd)                        rnd.nextInt()
chaining access         (.. person getAddress getZipCode)      person.getAddress().getZipCode()


                       (.getZipCode (.getAddress (person.)))


static member access                Math/PI                               Math.PI
Host Platforms
●   JVM
●   CLR / .NET
●   Javascript via Clojurescript
Break down
1. A Lisp
2. for Functional Programming
3. symbiotic with an established platform
4. designed for Concurrency
Designed for Concurrency
●   “I don't usually share State, but when I do...”
    ●   Must explicitly use special symbols, functions to
        share mutable State.
●   Easier to use concurrency safely in Clojure
Designed for Concurrency
●   Asynchronous - the request to update is queued to happen in
    another thread sometime later. The thread that made the request
    can continue immediately.

●   Coordinated - reads and writes to multiple refs can be made in a
    way that guarantees no race conditions.

●   Retriable - work is speculative and may have to be repeated.
Concurrency vs Parallelism
●   Parallelism -
      partitioning of one task into multiple parts, each that
      run at the same time


●   Concurrency -
      execution of disparate tasks at roughly the same
      time, sharing a common resource
mutation a la carte
●   Available are
             Shared?   Asynchronous?   Coordinated?   Retriable?
    Refs     yes       no              yes            yes
    Agents   yes       yes             no             no
    Atoms    yes       no              no             yes
Transactions
●   Software Transactional Memory (STM)
    ●   (dosync ... )
    ●   STM uses Multiversion Concurrency Control
         –    marks the old data as obsolete and adds the newer
             version




                                    –   http://en.wikipedia.org/wiki/Multiversion_concurrency_control
Refs
●   mutable references to objects
●   can only be changed within a transaction (TX)
    ●   (dosync ...)
●   no locks. no chance of a deadlock.
●   MVCC ensures snapshot isolation, each TX gets its
    own view of the data it is interested in.
●   each TX is oblivious to other TX's.
●   all ref modifications succeed or none do
●   If TX2 commits a change while TX1 is working, it may
    cause TX1 to be retried.
Refs




commute
    This fn should be commutative, or, failing that, you must accept last-one-in-wins
behavior. commute allows for more concurrency than ref-set.
Refs
Atoms




swap!
reset!
compare-and-set! - sets atom to new value if and only if current value of
the atom is identical to the old value.
Agents
Tooling
●   Libraries
●   REPL programming
●   Leiningen
    ●   project.clj
●   No IDE required, but many choices
Libraries
                          Web: Ring, Noir, HTML: Hiccup, Enlive
●   Java libraries        Hadoop: Cascalog, Statistics: Incanter
                          SQL: Korma, CQL, Riak: Welle
    ●   Maven etc...      Office Documents: docjure
                          & more...
●   Clojure libraries
    ●   clojars.org
REPL via Leiningen
] lein new clj-excel && cd clj-excel
now edit file “project.clj”




] lein deps && lein repl
REPL via Leiningen
] lein deps
] lein repl
Reading an Excel file
Excel file “sample.xlsx”
Reading an Excel file
IDE's and editors
●   Any editor with syntax highlighting will do

●   Your favorite Java IDE likely has a Clojure
    plugin

●   What do most folks use?
1,372 responses were received over 7 days.
               Anounced via Twitter & Clojure mailing list
               (~6700 recipients)




http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
I know Java, why should I consider Clojure?
That was a whirlwind grand tour...


      Thanks for listening!



        (def email {:name “aaelony” :domain “@gmail.com”})
Ad

More Related Content

What's hot (19)

CBOR - The Better JSON
CBOR - The Better JSONCBOR - The Better JSON
CBOR - The Better JSON
Christoph Engelbert
 
NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]
Huy Do
 
Web development basics (Part-4)
Web development basics (Part-4)Web development basics (Part-4)
Web development basics (Part-4)
Rajat Pratap Singh
 
Serialization and performance in Java
Serialization and performance in JavaSerialization and performance in Java
Serialization and performance in Java
Strannik_2013
 
DSLs in JavaScript
DSLs in JavaScriptDSLs in JavaScript
DSLs in JavaScript
elliando dias
 
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Chicago Hadoop Users Group
 
ApacheCon09: Avro
ApacheCon09: AvroApacheCon09: Avro
ApacheCon09: Avro
Cloudera, Inc.
 
Agile DSL Development in Ruby
Agile DSL Development in RubyAgile DSL Development in Ruby
Agile DSL Development in Ruby
elliando dias
 
Beyond JSON - An Introduction to FlatBuffers
Beyond JSON - An Introduction to FlatBuffersBeyond JSON - An Introduction to FlatBuffers
Beyond JSON - An Introduction to FlatBuffers
Maxim Zaks
 
Php
PhpPhp
Php
mohamed ashraf
 
Stay fresh
Stay freshStay fresh
Stay fresh
Ahmed Mohamed
 
JS - Basics
JS - BasicsJS - Basics
JS - Basics
John Fischer
 
Indic threads pune12-polyglot & functional programming on jvm
Indic threads pune12-polyglot & functional programming on jvmIndic threads pune12-polyglot & functional programming on jvm
Indic threads pune12-polyglot & functional programming on jvm
IndicThreads
 
Python and Zope: An introduction (May 2004)
Python and Zope: An introduction (May 2004)Python and Zope: An introduction (May 2004)
Python and Zope: An introduction (May 2004)
Kiran Jonnalagadda
 
Java 8 parallel stream
Java 8 parallel streamJava 8 parallel stream
Java 8 parallel stream
Yung Chieh Tsai
 
Rest style web services (google protocol buffers) prasad nirantar
Rest style web services (google protocol buffers)   prasad nirantarRest style web services (google protocol buffers)   prasad nirantar
Rest style web services (google protocol buffers) prasad nirantar
IndicThreads
 
JAVA 8 Parallel Stream
JAVA 8 Parallel StreamJAVA 8 Parallel Stream
JAVA 8 Parallel Stream
Tengwen Wang
 
2CPP02 - C++ Primer
2CPP02 - C++ Primer2CPP02 - C++ Primer
2CPP02 - C++ Primer
Michael Heron
 
Gluecon 2014 - Bringing Node.js to the JVM
Gluecon 2014 - Bringing Node.js to the JVMGluecon 2014 - Bringing Node.js to the JVM
Gluecon 2014 - Bringing Node.js to the JVM
Jeremy Whitlock
 
NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]
Huy Do
 
Web development basics (Part-4)
Web development basics (Part-4)Web development basics (Part-4)
Web development basics (Part-4)
Rajat Pratap Singh
 
Serialization and performance in Java
Serialization and performance in JavaSerialization and performance in Java
Serialization and performance in Java
Strannik_2013
 
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Chicago Hadoop Users Group
 
Agile DSL Development in Ruby
Agile DSL Development in RubyAgile DSL Development in Ruby
Agile DSL Development in Ruby
elliando dias
 
Beyond JSON - An Introduction to FlatBuffers
Beyond JSON - An Introduction to FlatBuffersBeyond JSON - An Introduction to FlatBuffers
Beyond JSON - An Introduction to FlatBuffers
Maxim Zaks
 
Indic threads pune12-polyglot & functional programming on jvm
Indic threads pune12-polyglot & functional programming on jvmIndic threads pune12-polyglot & functional programming on jvm
Indic threads pune12-polyglot & functional programming on jvm
IndicThreads
 
Python and Zope: An introduction (May 2004)
Python and Zope: An introduction (May 2004)Python and Zope: An introduction (May 2004)
Python and Zope: An introduction (May 2004)
Kiran Jonnalagadda
 
Rest style web services (google protocol buffers) prasad nirantar
Rest style web services (google protocol buffers)   prasad nirantarRest style web services (google protocol buffers)   prasad nirantar
Rest style web services (google protocol buffers) prasad nirantar
IndicThreads
 
JAVA 8 Parallel Stream
JAVA 8 Parallel StreamJAVA 8 Parallel Stream
JAVA 8 Parallel Stream
Tengwen Wang
 
Gluecon 2014 - Bringing Node.js to the JVM
Gluecon 2014 - Bringing Node.js to the JVMGluecon 2014 - Bringing Node.js to the JVM
Gluecon 2014 - Bringing Node.js to the JVM
Jeremy Whitlock
 

Viewers also liked (6)

JavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java DevelopersJavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java Developers
Jan Kronquist
 
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
 
Clojure Intro
Clojure IntroClojure Intro
Clojure Intro
Misha Kozik
 
Functional web development with Git(Hub), Heroku and Clojure
Functional web development with Git(Hub), Heroku and ClojureFunctional web development with Git(Hub), Heroku and Clojure
Functional web development with Git(Hub), Heroku and Clojure
Jacek Laskowski
 
Clojure for Java developers - Stockholm
Clojure for Java developers - StockholmClojure for Java developers - Stockholm
Clojure for Java developers - Stockholm
Jan Kronquist
 
Introduction to Clojure
Introduction to ClojureIntroduction to Clojure
Introduction to Clojure
Renzo Borgatti
 
JavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java DevelopersJavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java Developers
Jan Kronquist
 
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
 
Functional web development with Git(Hub), Heroku and Clojure
Functional web development with Git(Hub), Heroku and ClojureFunctional web development with Git(Hub), Heroku and Clojure
Functional web development with Git(Hub), Heroku and Clojure
Jacek Laskowski
 
Clojure for Java developers - Stockholm
Clojure for Java developers - StockholmClojure for Java developers - Stockholm
Clojure for Java developers - Stockholm
Jan Kronquist
 
Introduction to Clojure
Introduction to ClojureIntroduction to Clojure
Introduction to Clojure
Renzo Borgatti
 
Ad

Similar to I know Java, why should I consider Clojure? (20)

Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
prat0ham
 
Concurrency Programming in Java - 01 - Introduction to Concurrency Programming
Concurrency Programming in Java - 01 - Introduction to Concurrency ProgrammingConcurrency Programming in Java - 01 - Introduction to Concurrency Programming
Concurrency Programming in Java - 01 - Introduction to Concurrency Programming
Sachintha Gunasena
 
Seeking Clojure
Seeking ClojureSeeking Clojure
Seeking Clojure
chrisriceuk
 
New c sharp4_features_part_iv
New c sharp4_features_part_ivNew c sharp4_features_part_iv
New c sharp4_features_part_iv
Nico Ludwig
 
Programming with Threads in Java
Programming with Threads in JavaProgramming with Threads in Java
Programming with Threads in Java
koji lin
 
Simon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSimon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelism
Skills Matter
 
Peyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_futurePeyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_future
Takayuki Muranushi
 
Memory models in c#
Memory models in c#Memory models in c#
Memory models in c#
Sophie Obomighie
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
Prashant Rane
 
Rethinking the debugger
Rethinking the debuggerRethinking the debugger
Rethinking the debugger
Iulian Dragos
 
Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)
Martijn Verburg
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at Twitter
Alex Payne
 
Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)
Martijn Verburg
 
The Rise of Functional Programming
The Rise of Functional ProgrammingThe Rise of Functional Programming
The Rise of Functional Programming
Tjerk W
 
Presentación rs232 java
Presentación rs232 javaPresentación rs232 java
Presentación rs232 java
John Rojas
 
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
Metosin Oy
 
Comp102 lec 3
Comp102   lec 3Comp102   lec 3
Comp102 lec 3
Fraz Bakhsh
 
Aleksandr_Butenko_Mobile_Development
Aleksandr_Butenko_Mobile_DevelopmentAleksandr_Butenko_Mobile_Development
Aleksandr_Butenko_Mobile_Development
Ciklum
 
Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?
Michał Konarski
 
Java & advanced java
Java & advanced javaJava & advanced java
Java & advanced java
BASAVARAJ HUNSHAL
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
prat0ham
 
Concurrency Programming in Java - 01 - Introduction to Concurrency Programming
Concurrency Programming in Java - 01 - Introduction to Concurrency ProgrammingConcurrency Programming in Java - 01 - Introduction to Concurrency Programming
Concurrency Programming in Java - 01 - Introduction to Concurrency Programming
Sachintha Gunasena
 
New c sharp4_features_part_iv
New c sharp4_features_part_ivNew c sharp4_features_part_iv
New c sharp4_features_part_iv
Nico Ludwig
 
Programming with Threads in Java
Programming with Threads in JavaProgramming with Threads in Java
Programming with Threads in Java
koji lin
 
Simon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSimon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelism
Skills Matter
 
Peyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_futurePeyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_future
Takayuki Muranushi
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
Prashant Rane
 
Rethinking the debugger
Rethinking the debuggerRethinking the debugger
Rethinking the debugger
Iulian Dragos
 
Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)
Martijn Verburg
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at Twitter
Alex Payne
 
Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)
Martijn Verburg
 
The Rise of Functional Programming
The Rise of Functional ProgrammingThe Rise of Functional Programming
The Rise of Functional Programming
Tjerk W
 
Presentación rs232 java
Presentación rs232 javaPresentación rs232 java
Presentación rs232 java
John Rojas
 
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
Metosin Oy
 
Aleksandr_Butenko_Mobile_Development
Aleksandr_Butenko_Mobile_DevelopmentAleksandr_Butenko_Mobile_Development
Aleksandr_Butenko_Mobile_Development
Ciklum
 
Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?
Michał Konarski
 
Ad

Recently uploaded (20)

UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Unlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive GuideUnlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive Guide
vikasascentbpo
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Web and Graphics Designing Training in Rajpura
Web and Graphics Designing Training in RajpuraWeb and Graphics Designing Training in Rajpura
Web and Graphics Designing Training in Rajpura
Erginous Technology
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Social Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTechSocial Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTech
Steve Jonas
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdfAre Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Telecoms Supermarket
 
MINDCTI revenue release Quarter 1 2025 PR
MINDCTI revenue release Quarter 1 2025 PRMINDCTI revenue release Quarter 1 2025 PR
MINDCTI revenue release Quarter 1 2025 PR
MIND CTI
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Unlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive GuideUnlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive Guide
vikasascentbpo
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Web and Graphics Designing Training in Rajpura
Web and Graphics Designing Training in RajpuraWeb and Graphics Designing Training in Rajpura
Web and Graphics Designing Training in Rajpura
Erginous Technology
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Social Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTechSocial Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTech
Steve Jonas
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdfAre Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Telecoms Supermarket
 
MINDCTI revenue release Quarter 1 2025 PR
MINDCTI revenue release Quarter 1 2025 PRMINDCTI revenue release Quarter 1 2025 PR
MINDCTI revenue release Quarter 1 2025 PR
MIND CTI
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 

I know Java, why should I consider Clojure?

  • 1. Introducing Clojure as a powerful JVM language from a value-added perspective for those that already know Java. a.k.a. “Okay, I know Java, why should I consider Clojure?”
  • 2. A little about me ● Avram Aelony ● My programming language evolution ● Notes about evangelism ● use the language you prefer “whenever, wherever...” like Shakira says ● How I came to Clojure
  • 3. Disclaimers ● Standing on the shoulders of giants, luminaries ● This is a HUGE topic ● The Good news: ● There are MUCH better (explained, comprehensive, deeper) talks on this topic than mine ● I will reference them ● Should you remain unconvinced by this talk, there are inumerable resources online that may be somewhat more convincing
  • 4. Audience survey ● Java ? ● Clojure ? ● Other functional language? ● Other JVM language?
  • 5. Utility ● Why is Clojure useful if you know Java? ● It adds to what you know ● Provides simplicity, concision, more l
  • 6. Grand tour ● Idea is to go into the Rationale and introduce Clojure along the way ● Mostly about the Why rather than the How ● ... some How as well...
  • 7. Preliminaries and Similarities Source: "Clojure-Java Interop: A Better Java than Java" http://www.infoq.com/presentations/Clojure-Java-Interop
  • 8. Rationale "I wanted: A Lisp for Functional Programming symbiotic with an established Platform designed for Concurrency." ● - Rich Hickey, creator of Clojure http://clojure.org/rationale
  • 9. Break down 1. A Lisp 2. for Functional Programming 3. symbiotic with an established platform 4. designed for Concurrency
  • 10. Break down 1. A Lisp 2. for Functional Programming 3. symbiotic with an established platform 4. designed for Concurrency
  • 11. A Lisp ● Dynamic typing ● Homoiconic: Uniform, elegant syntax ● Expression oriented: Symbolic expressions ● Lambda calculus: variable binding ● Macros ● Code as data ● Data as code
  • 12. Clojure Data Structures ● Lists '( 1 2 3 4 ) ● new insertions go to the front ● Vectors [ 1 2 3 4 ] ● new insertions go to the back ● Maps { :a 1 :b 2 :c 3 :d 4} ● Sets #{ :a :b :c :d } ● implemented as k/v where k=v.
  • 15. Immutable Data ● So how can things change? ● New things can be created ● Underlying structure is shared wherever possible ● only connections change
  • 16. Immutable Data + Structural Sharing identical? function that returns true only when symbols are in fact the same object. Phillip Potter http://skillsmatter.com/podcast/scala/persistent-data-structures-in-clojure
  • 17. Collections Abstraction ● Vectors, Maps, Sets can be thought of as Collections. ● Most functions that work on one data structure will work on any other. ● Easy to change from Vector to Map to Set with minimal refactoring of functions.
  • 18. Sequences and Collections ● seqs are persistent and immutable ● seq function ● lazyiness, lazy application ● seq interface
  • 19. Seqs
  • 20. Homo-iconic Homo = Same, Iconic = representation
  • 22. Fizz Buzz Print the numbers from 1 to N If a number is divisible by 3, print "Fizz" instead If a number is divisible by 5, print "Buzz" instead If a number is divisible by 3 and 5, print "FizzBuzz" instead
  • 24. S-Expressions, data as code as seen in The Joy of Clojure
  • 25. S-Expressions, data as code ● John McCarthy ● assign symbolic names to clojure data ● trees of expressions, each of which returns a value ● functions can be assigned to vars ● def, fn, defn http://en.wikipedia.org/wiki/Symbolic_expression
  • 26. Macros ● Why Macros? ● to arrange code differently – Threading macros -> and ->> – infix versus postfix – dot and dot dot macros for Java interop ● to remove or reduce boilerplate code
  • 27. “The whole language is always available. There is no real distinction between read-time, compile-time, and runtime. You can compile or run code while reading, read or run code while compiling, and read or compile code at runtime.” “Running code at read-time lets users reprogram Lisp's syntax; running code at compile-time is the basis of macros; compiling at runtime is the basis of Lisp's use as an extension language in programs like Emacs; and reading at runtime enables programs to communicate using s-expressions, an idea recently reinvented as XML. “ What Made Lisp Different http://www.paulgraham.com/diff.htm
  • 28. Compilation ● “Clojure compiles all code you load on-the-fly into JVM bytecode, but sometimes it is advantageous to compile ahead-of-time (AOT).” http://clojure.org/compilation
  • 30. Code as data, Data as Code
  • 31. Break down 1. A Lisp 2. for Functional Programming 3. symbiotic with an established platform 4. designed for Concurrency
  • 32. Functional Programming ● tools to avoid mutable state, data ● referential transparency ● functions are first class objects ● emphasizes application of functions ● emphasizes recursive iteration ● encourages higher-order functions http://clojure.org/functional_programming http://en.wikipedia.org/wiki/Functional_programming http://en.wikipedia.org/wiki/Referential_transparency_%28computer_science%29
  • 33. Referential Transparency ● expressions can be replaced with their value without changing the behavior of the program ● easier to reason about programs “... can help in proving correctness, simplifying an algorithm, assisting in modifying code without breaking it, or optimizing code by means of memoization, common subexpression elimination or parallelization.” -wikipedia http://en.wikipedia.org/wiki/Referential_transparency_%28computer_science%29
  • 34. Higher Order Functions map is an example of a higher order function, since it applies another function to a collection. juxt is a higher order function that juxtaposes the values that result from the application of one or more functions.
  • 36. Not exactly what we want without map Higher order functions allow for great flexibility in re-shaping data.
  • 37. Break down 1. A Lisp 2. for Functional Programming 3. symbiotic with an established platform 4. designed for Concurrency
  • 38. JVM as host platform ● Interop as built-in syntax ● Java libraries easily used from Clojure ● e.g. Hadoop, Apache libraries, anything in a Maven repo, etc..
  • 39. Java Interop Clojure Java Constructor (Widget. “foo”) new Widget(“foo”) Instance members (.nextInt rnd) rnd.nextInt() chaining access (.. person getAddress getZipCode) person.getAddress().getZipCode() (.getZipCode (.getAddress (person.))) static member access Math/PI Math.PI
  • 40. Host Platforms ● JVM ● CLR / .NET ● Javascript via Clojurescript
  • 41. Break down 1. A Lisp 2. for Functional Programming 3. symbiotic with an established platform 4. designed for Concurrency
  • 42. Designed for Concurrency ● “I don't usually share State, but when I do...” ● Must explicitly use special symbols, functions to share mutable State. ● Easier to use concurrency safely in Clojure
  • 43. Designed for Concurrency ● Asynchronous - the request to update is queued to happen in another thread sometime later. The thread that made the request can continue immediately. ● Coordinated - reads and writes to multiple refs can be made in a way that guarantees no race conditions. ● Retriable - work is speculative and may have to be repeated.
  • 44. Concurrency vs Parallelism ● Parallelism - partitioning of one task into multiple parts, each that run at the same time ● Concurrency - execution of disparate tasks at roughly the same time, sharing a common resource
  • 45. mutation a la carte ● Available are Shared? Asynchronous? Coordinated? Retriable? Refs yes no yes yes Agents yes yes no no Atoms yes no no yes
  • 46. Transactions ● Software Transactional Memory (STM) ● (dosync ... ) ● STM uses Multiversion Concurrency Control – marks the old data as obsolete and adds the newer version – http://en.wikipedia.org/wiki/Multiversion_concurrency_control
  • 47. Refs ● mutable references to objects ● can only be changed within a transaction (TX) ● (dosync ...) ● no locks. no chance of a deadlock. ● MVCC ensures snapshot isolation, each TX gets its own view of the data it is interested in. ● each TX is oblivious to other TX's. ● all ref modifications succeed or none do ● If TX2 commits a change while TX1 is working, it may cause TX1 to be retried.
  • 48. Refs commute This fn should be commutative, or, failing that, you must accept last-one-in-wins behavior. commute allows for more concurrency than ref-set.
  • 49. Refs
  • 50. Atoms swap! reset! compare-and-set! - sets atom to new value if and only if current value of the atom is identical to the old value.
  • 52. Tooling ● Libraries ● REPL programming ● Leiningen ● project.clj ● No IDE required, but many choices
  • 53. Libraries Web: Ring, Noir, HTML: Hiccup, Enlive ● Java libraries Hadoop: Cascalog, Statistics: Incanter SQL: Korma, CQL, Riak: Welle ● Maven etc... Office Documents: docjure & more... ● Clojure libraries ● clojars.org
  • 54. REPL via Leiningen ] lein new clj-excel && cd clj-excel now edit file “project.clj” ] lein deps && lein repl
  • 55. REPL via Leiningen ] lein deps ] lein repl
  • 56. Reading an Excel file Excel file “sample.xlsx”
  • 58. IDE's and editors ● Any editor with syntax highlighting will do ● Your favorite Java IDE likely has a Clojure plugin ● What do most folks use?
  • 59. 1,372 responses were received over 7 days. Anounced via Twitter & Clojure mailing list (~6700 recipients) http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
  • 61. That was a whirlwind grand tour... Thanks for listening! (def email {:name “aaelony” :domain “@gmail.com”})