Clojure
Definition
Clojure is a modern, dynamically-typed dialect of Lisp, it emphasizes immutability, concurrency, and functional programming patterns.
Key Details
- Paradigm: Multi-paradigm (functional, concurrent, imperative)
- License: Eclipse Public License 1.0
- Runtimes: Clojure (JVM), ClojureScript (JS), ClojureCLR (.NET)
- Creator: Rich Hickey
- First released: 2007
Language Features
- Immutability by default: Persistent data structures ensure thread safety
- Concurrency primitives: Atoms, refs, vars, agents for synchronized state management
- Macros: Powerful compile-time code transformation (inherited from Lisp
- Homoiconicity: Code is data (S-expressions)
- REPL-driven development: Interactive development workflow
- Interoperability: Full access to JVM libraries (Java interop)
Core Data Structures
| Structure |
Description |
| List |
Ordered collection, linked-list |
| Vector |
Indexed, persistent, O(log32 n) access |
| Map |
Key-value pairs, persistent |
| Set |
Unique elements, persistent |
| Queue |
FIFO collection |
| Tool |
Purpose |
| Ring |
Web server interface (like WSGI for Python) |
| Compojure |
Web routing framework |
| ClojureScript |
Compile Clojure to JavaScript |
| tools.deps |
Dependency management |
| Leiningen |
Build tool and project management |
| Re-frame |
Reactive frontend framework (like React) |
Use Cases
- Web application backends
- Data processing and analytics
- Financial services (hedge funds, trading platforms)
- Real-time systems
- Configuration and DSLs