Safekipedia

Clojure

Adapted from Wikipedia · Discoverer experience

Portrait of Rich Hickey, the inventor of the Clojure programming language.

Clojure is a special kind of programming language that runs on the Java platform. It is both dynamic and functional, meaning it can change and work well with data transformations. Clojure is a version of Lisp, an old programming language known for its simple and flexible style.

Clojure uses a unique way of writing code called S-expressions. These are parsed into data structures, making it easy to work with lists, maps, sets, and vectors. One important feature of Clojure is that it treats code as data, allowing powerful tools like macros to change how code behaves.

Clojure was created by Rich Hickey in the mid-2000s. It focuses on immutability, which means data doesn’t change once it’s created. This helps programmers build reliable and fast programs, especially when many things happen at the same time. Though it started on the Java platform, Clojure has also been made to work on other systems like .NET. Rich Hickey still leads the development of Clojure.

History

Rich Hickey created the Clojure language. Before Clojure, he worked on a similar project called dotLisp for the .NET platform and also made three earlier projects to connect Lisp with Java. These were a special way for Common Lisp to work with Java, a tool called FOIL, and a way to use Lisp with web tools called Lisplets.

Rich Hickey, creator of Clojure

Hickey began working on Clojure in 2005 and spent about two and a half years developing it before sharing it with the public in October 2007. During this time, he focused only on Clojure without any outside support. His wife, Stephanie Hickey, helped by listening and talking about the language, though she did not write any code. At the end of this period, Hickey told some friends in the Common Lisp community about Clojure through an email.

The name "Clojure" is a playful twist on the term "closure", and includes the letters C, L, and J to represent C#, Lisp, and Java. These three languages greatly influenced how Clojure was designed.

Design

Rich Hickey created Clojure to be a modern Lisp for functional programming that works well with the Java platform and helps with concurrency. He believes that programming languages and software should be simple, with loose coupling and stateless functions.

Clojure uses the idea of identities to handle changes over time. These identities are made of unchanging states, so many workers can use them at the same time without problems. Clojure has special types called reference types to help manage these changes.

Clojure runs on the Java platform, so it can call Java code and be called from Java. It has tools like the Clojure command-line interface and Leiningen to help with projects and manage Maven integration.

As a Lisp dialect, Clojure treats functions as important objects and has a system for creating macros. It also supports lazy sequences and encourages immutability and persistent data structures. Clojure focuses on recursion and higher-order functions rather than loops with side effects. For working with many tasks at once, Clojure uses software transactional memory, a reactive agent system, and channel-based programming.

Extensible Data Notation

Extensible Data Notation, or edn, is a special way to share data that comes from the Clojure language. It can save and load Clojure data, and Clojure uses a version of edn to write its programs.

Like JSON or XML, edn has many built-in parts, such as words, numbers, and groups of items. It can also grow by using special signs called tags. These tags start with # and a word, letting the system know how to handle the data that follows. This helps make edn flexible without needing extra rules.

Alternative platforms

Clojure mainly works with Java, but it can also run on other platforms. One popular version is ClojureScript, which turns Clojure code into ECMAScript for web browsers. There is also ClojureCLR, which works with the .NET platform.

Other versions of Clojure include:

  • Babashka, which uses GraalVM
  • ClojureDart for mobile and desktop apps using Dart and Flutter
  • Clojerl on the BEAM virtual machine used by Erlang
  • basilisp, targeting Python 3.8+
  • ClojureRS on Rust
  • Ferret, compiling to C++11 for small devices
  • jank, using C++ and LLVM
  • Joker, an interpreter and linter in Go

Tools

There are many tools to help people write Clojure code. Some popular ones work with different programs you might already use, like Emacs, IntelliJ IDEA, Sublime Text, Vim, and Visual Studio Code. These tools have special add-ons to make writing Clojure easier.

Clojure also has its own command-line tools that work on computers running Linux, macOS, and Windows. These tools help you manage and run your Clojure projects.

Development

The Clojure team works together to create and improve the language. You can see their work and share ideas on a special website called ask.clojure.org. If an idea is important, a team member will add it to their list of tasks. These tasks are then checked by a group of reviewers and finally approved by the leader, Rich Hickey.

Impact

Clojure has become more popular among software developers who use the Java platform. Many well-known developers and companies recommend and use Clojure. For example, big companies like Apple, Netflix, and NASA use Clojure in their work.

In a big survey of Java developers in 2018, Clojure was ranked as the second most used programming language on the Java platform for important applications. In a more recent survey from 2023, developers who had used Clojure liked it very much, with many saying they wanted to keep using it. However, fewer developers said they wanted to learn Clojure compared to other popular languages like JavaScript.

Release history

VersionRelease dateMajor features, improvements
October 17, 2007 (2007-10-17)Initial public release
1.0May 4, 2009 (2009-05-04)First stable release
1.1December 31, 2009 (2009-12-31)Futures
1.2August 19, 2010 (2010-08-19)Protocols
1.3September 23, 2011 (2011-09-23)Enhanced primitive support
1.4April 15, 2012 (2012-04-15)Reader literals
1.5March 1, 2013 (2013-03-01)Reducers
1.5.1March 10, 2013 (2013-03-10)Fixing a memory leak
1.6March 25, 2014 (2014-03-25)Java API, improved hashing algorithms
1.7June 30, 2015 (2015-06-30)Transducers, reader conditionals
1.8January 19, 2016 (2016-01-19)Additional string functions, direct linking, socket server
1.9December 8, 2017 (2017-12-08)Integration with spec, command-line tools
1.10December 17, 2018 (2018-12-17)Improved error reporting, Java compatibility
1.10.1June 6, 2019 (2019-06-06)Working around a Java performance regression and improving error reporting from clojure.main
1.10.2January 26, 2021 (2021-01-26)Java interoperability/compatibility improvements and other important language fixes
1.10.3March 4, 2021 (2021-03-04)prepl support for reader conditionals
1.11.0March 22, 2022 (2022-03-22)New syntax for keyword argument invocation, new clojure.math namespace, namespace aliasing without loading, and new helper functions added to clojure.core
1.11.1April 5, 2022 (2022-04-05)Rolling back unintended change in binary serialisation of objects of types clojure.lang.Keyword and clojure.lang.ArraySeq.
1.11.2March 8, 2024 (2024-03-08)Fix for CVE-2024-22871 Denial of Service
1.12.0September 5, 2024 (2024-09-05)Java method values, params type hints, array class syntax, add-lib, clojure.java.process
1.12.1June 2, 2025 (2025-06-02)Includes bug fixes, improved interop, enhanced tool support, and metadata updates.
1.12.2August 25, 2025 (2025-08-25)Fixes for CLJ-2914, CLJ-1798, CLJ-2916 and CLJ-2917.
1.12.3August 25, 2025 (2025-08-25)Fix for CLJ-2919.
Latest version: 1.12.4December 10, 2025 (2025-12-10)Fix for CLJ-2924.
Legend:
Unsupported
Supported
Latest version
Preview version
Future version

Related articles

This article is a child-friendly adaptation of the Wikipedia article on Clojure, available under CC BY-SA 4.0.

Images from Wikimedia Commons. Tap any image to view credits and license.