This page is being reviewed and updated
I love Clojure because its powerful, flexible and fun.
Clojure encourages the creation of simple software systems by being immutable by default and encouraging pragmatic approach to pure functional design.
Come back to concepts as you learn the language
If you are eager to try Clojure, you can come back to this section and get a deeper understanding of the design and phylosophy of the Clojure approach to functional programming. These concepts will be easier to relate to as you practice Clojure and build software solutions.
Clojure is ...
- a functional programming language with a data centric approach, pragmatically pure
- a very small syntax comprised of only 16 primitives, 8 of which were added for host interoperability
- a dynamic strongly typed language type inference simplifies syntax and code base
- a REPL fast-feedback evaluate code as you write it for instant feedback, helping you quickly explore a problem domain
- a modern implementation of LISP
- highly extensible language via macros
- an efficient way to manage state changes via persistent data structures & software transactional memory
Clojure in a little more detail
Dynamic Language & runtime environment (REPL)
- quickly explore your problem domain by evaluating code on the fly in the REPL
- new code is compiled as evaluated, no seperate compile cycle or wait time
- very small language syntax, extensible via macros
Pragmatic Functional Programming
- encourages an immutable approach that helps keep the code simple
- minimising state changes makes scaling your application easy through parallelism
- built-in persistent data structures (List, Map, Vector, Set) give an efficient way of modifying data without side effects
- Concurrency becomes trivial with pure functions & immutable data
Managed State Changes
- Reference types
refsfor mutable state
- Changes are done safely within Software Transactional Memory (STM), like having an in-memory ACID database managing all state changes under the covers.
Avoid changing state
In functional programming we avoid changing state as much as possible. If a function does not change state it is referentially transparent, always returning the same result when given the same input (arguments). These are refered to as Pure Functions. Pure functions are truely modular as they do not affect any other part of the system and do not require complex threading for scalability.
Hosted language with consise interoperabilty
- Clojure is compiled to bytecode, giving very high performance (close to Java, C++, etc.)
- Simple syntax to call any other code that runs on the JVM (Java, Scala, JRuby, Jython, etc) or Microsoft CLR.
A modular / component approach to design
A typical approach with Clojure is to break a big problem space into small libraries, each with a specific perpose. This helps deconstruct complex systems into smaller, easier to understand code. This also helps make these Clojure libraries reusable in many other projects, reducing the development effort.
ClojureScript is based heavily on the work done for Google Closures and there is a strong focus on Reactive client side apps.
There is a common file extension,
There is a vibrant and highly active community around Clojure. In London alone there is a regular monthly talk and 3 or 4 coding dojo every month.