- Shares with Lisp the code-as-data philosophy and a powerful macro system.
- Favours immutable, persistent data structures (values don't change)
- Not a strictly pure language which makes it practical
Sum a list of numbers in Python:
>>> sum = 0
>>> for n in [1, 2, 3]:
... sum = sum + n
...
>>> sum
6
Sum a list of numbers in Clojure:
user=> (reduce + [1 2 3])
6
- Offers a software transactional memory system (think transactions in a database) and reactive Agent system that ensure clean, correct, multithreaded designs.
- Compiled at runtime allowing runtime access to all features
- Favours developing with a Read Eval Print Loop (REPL)
A basic set of examples can be found in src/intro/core.clj
and ran in a REPL.
To run the examples:
- Clone this repository,
- Install Leiningen
- Change to the project directory and run
lein repl
to open a REPL that you can copy the examples into
The examples are taken from http://learnxinyminutes.com/docs/clojure/ (licensed under CC BY-SA 3.0). This project is also licensed under CC BY-SA 3.0.