This document provides an overview of the Clojure programming language. Some key points:
1) Clojure is a Lisp dialect that runs on the Java Virtual Machine (JVM), allowing for concurrent and dynamic development.
2) In Clojure, everything is treated as data - code is represented as regular data structures like lists and maps rather than hardcoded syntax.
3) Clojure favors immutable, persistent data over mutable variables. This simplicity allows for easy parallelization and avoids common bugs from side effects.
4. “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".
7. LISt Processing
LIS
● Second oldest high-level language (first is
Fortran)
● Code as Data (Homoiconic)
● Perfect for Domain-specific languages
(DSL)
● Exploratory programming
8. Clojure
● Lisp in JVM
● Concurrent programming
● Dynamic Development (REPL)
● Lazy sequences
● No side effects (almost)
24. Clojure vs Java code
● Side-effect free ● Error prone
● Easy to (unit) test ● Not so easy
● Lazy collection ● Only one element
● Any element ● Only with chars
● Slower ● Faster
● Data manipulation ● If/for/while code
● Exploratory ● Design Is Law
25. Clojure is a functional language
● Functions are first-class objects
● Data is immutable
● Functions are pure
27. ● Simple: no loops, variables or mutable
state
● Thread-safe: no locking
● Parallelizable: map/reduce anyone?
● Generic: data is always data
● Easy to test: same input, same output
41. Solving problems
● Experiment with the problem
● Create your data structures
● Data transformations
● Write code that writes code for you
(macros)
● Create a mini language (a DSL)