From Wikipedia for FEVERv2
Jump to navigation Jump to search

For similarly sounding names, see closure. Clojure_sentence_0


ParadigmClojure_header_cell_0_0_0 multi-paradigm:Clojure_cell_0_0_1
FamilyClojure_header_cell_0_1_0 LispClojure_cell_0_1_1
Designed byClojure_header_cell_0_2_0 Rich HickeyClojure_cell_0_2_1
First appearedClojure_header_cell_0_3_0 2007; 13 years ago (2007)Clojure_cell_0_3_1
Stable releaseClojure_header_cell_0_4_0 1.10.1
  / 6 June 2019; 18 months ago (2019-06-06)Clojure_cell_0_4_1
Preview releaseClojure_header_cell_0_5_0 1.10.2-alpha1
  / 5 March 2020; 9 months ago (2020-03-05)Clojure_cell_0_5_1
Typing disciplineClojure_header_cell_0_6_0 Clojure_cell_0_6_1
PlatformClojure_header_cell_0_7_0 Clojure_cell_0_7_1
LicenseClojure_header_cell_0_8_0 Eclipse Public LicenseClojure_cell_0_8_1
Clojure_header_cell_0_9_0 Clojure_cell_0_9_1
WebsiteClojure_header_cell_0_10_0 Clojure_cell_0_10_1
Influenced byClojure_header_cell_0_11_0

Clojure (/ˈkloʊʒər/, like closure) is a modern, dynamic, and functional dialect of the Lisp programming language on the Java platform. Clojure_sentence_1

Like other Lisp dialects, Clojure treats code as data and has a Lisp macro system. Clojure_sentence_2

The current development process is community-driven, overseen by Rich Hickey as its benevolent dictator for life (BDFL). Clojure_sentence_3

Clojure advocates immutability and immutable data structures and encourages programmers to be explicit about managing identity and its states. Clojure_sentence_4

This focus on programming with immutable values and explicit progression-of-time constructs is intended to facilitate developing more robust, especially concurrent, programs that are simple and fast. Clojure_sentence_5

While its type system is entirely dynamic, recent efforts have also sought the implementation of gradual typing. Clojure_sentence_6

Commercial support for Clojure is provided by Cognitect. Clojure_sentence_7

Clojure conferences are organized every year across the globe, the most famous of them being Clojure/conj. Clojure_sentence_8

History and development process Clojure_section_0

Rich Hickey is the creator of the Clojure language. Clojure_sentence_9

Before Clojure, he developed dotLisp, a similar project based on the .NET platform, and three earlier attempts to provide interoperability between Lisp and Java: a Java foreign language interface for Common Lisp (jfli), A Foreign Object Interface for Lisp (FOIL), and a Lisp-friendly interface to Java Servlets (Lisplets). Clojure_sentence_10

Hickey spent about 2½ years working on Clojure before releasing it publicly, much of that time working exclusively on Clojure with no outside funding. Clojure_sentence_11

At the end of this time, Hickey sent an email announcing the language to some friends in the Common Lisp community. Clojure_sentence_12

The development process is community-driven and is managed at the Clojure JIRA project page. Clojure_sentence_13

General development discussion occurs at the Clojure Google Group. Clojure_sentence_14

Anyone can submit issues and ideas at, but to contribute patches, one must sign the Clojure Contributor agreement. Clojure_sentence_15

JIRA issues are processed by a team of screeners and finally Rich Hickey approves the changes. Clojure_sentence_16

Clojure's name, according to Hickey, is a pun on the programming concept "closure" incorporating the letters C, L, and J for C#, Lisp, and Java respectively—three languages which had a major influence on Clojure's design. Clojure_sentence_17

Design philosophy Clojure_section_1

Rich Hickey developed Clojure because he wanted a modern Lisp for functional programming, symbiotic with the established Java platform, and designed for concurrency. Clojure_sentence_18

Clojure's approach to state is characterized by the concept of identities, which are represented as a series of immutable states over time. Clojure_sentence_19

Since states are immutable values, any number of workers can operate on them in parallel, and concurrency becomes a question of managing changes from one state to another. Clojure_sentence_20

For this purpose, Clojure provides several mutable reference types, each having well-defined semantics for the transition between states. Clojure_sentence_21

Language overview Clojure_section_2


VersionClojure_header_cell_1_0_0 Release dateClojure_header_cell_1_0_1 Major features/improvementsClojure_header_cell_1_0_2
Clojure_cell_1_1_0 October 16, 2007Clojure_cell_1_1_1 Initial public releaseClojure_cell_1_1_2
1.0Clojure_cell_1_2_0 May 4, 2009Clojure_cell_1_2_1 First stable releaseClojure_cell_1_2_2
1.1Clojure_cell_1_3_0 December 31, 2009Clojure_cell_1_3_1 FuturesClojure_cell_1_3_2
1.2Clojure_cell_1_4_0 August 19, 2010Clojure_cell_1_4_1 ProtocolsClojure_cell_1_4_2
1.3Clojure_cell_1_5_0 September 23, 2011Clojure_cell_1_5_1 Enhanced primitive supportClojure_cell_1_5_2
1.4Clojure_cell_1_6_0 April 15, 2012Clojure_cell_1_6_1 Reader literalsClojure_cell_1_6_2
1.5Clojure_cell_1_7_0 March 1, 2013Clojure_cell_1_7_1 ReducersClojure_cell_1_7_2
1.5.1Clojure_cell_1_8_0 March 10, 2013Clojure_cell_1_8_1 Fixing a memory leakClojure_cell_1_8_2
1.6Clojure_cell_1_9_0 March 25, 2014Clojure_cell_1_9_1 Java API, improved hashing algorithmsClojure_cell_1_9_2
1.7Clojure_cell_1_10_0 June 30, 2015Clojure_cell_1_10_1 Transducers, reader conditionalsClojure_cell_1_10_2
1.8Clojure_cell_1_11_0 January 19, 2016Clojure_cell_1_11_1 Additional string functions, direct linking, socket serverClojure_cell_1_11_2
1.9Clojure_cell_1_12_0 December 8, 2017Clojure_cell_1_12_1 Integration with spec, command-line toolsClojure_cell_1_12_2
1.10Clojure_cell_1_13_0 December 17, 2018Clojure_cell_1_13_1 Improved error reporting, Java compatibilityClojure_cell_1_13_2
Current stable version: 1.10.1Clojure_cell_1_14_0 June 6, 2019Clojure_cell_1_14_1 Working around a Java performance regression and improving error reporting from clojure.mainClojure_cell_1_14_2
Legend:Old versionOlder version, still maintainedLatest versionLatest preview versionFuture releaseClojure_cell_1_15_0

Clojure runs on the Java platform and as a result, integrates with Java and fully supports calling Java code from Clojure, and Clojure code can be called from Java also. Clojure_sentence_22

The community uses Leiningen for project automation, providing support for Maven integration. Clojure_sentence_23

Leiningen handles project package management and dependencies and is configured using Clojure syntax. Clojure_sentence_24

Like most other Lisps, Clojure's syntax is built on S-expressions that are first parsed into data structures by a reader before being compiled. Clojure_sentence_25

Clojure's reader supports literal syntax for maps, sets and vectors in addition to lists, and these are compiled to the mentioned structures directly. Clojure_sentence_26

Clojure is a Lisp-1 and is not intended to be code-compatible with other dialects of Lisp, since it uses its own set of data structures incompatible with other Lisps. Clojure_sentence_27

As a Lisp dialect, Clojure supports functions as first-class objects, a read–eval–print loop (REPL), and a macro system. Clojure_sentence_28

Clojure's Lisp macro system is very similar to that in Common Lisp with the exception that Clojure's version of the backquote (termed "syntax quote") qualifies symbols with their namespace. Clojure_sentence_29

This helps prevent unintended name capture, as binding to namespace-qualified names is forbidden. Clojure_sentence_30

It is possible to force a capturing macro expansion, but it must be done explicitly. Clojure_sentence_31

Clojure does not allow user-defined reader macros, but the reader supports a more constrained form of syntactic extension. Clojure_sentence_32

Clojure supports multimethods and for interface-like abstractions has a protocol based polymorphism and data type system using records, providing high-performance and dynamic polymorphism designed to avoid the expression problem. Clojure_sentence_33

Clojure has support for lazy sequences and encourages the principle of immutability and persistent data structures. Clojure_sentence_34

As a functional language, emphasis is placed on recursion and higher-order functions instead of side-effect-based looping. Clojure_sentence_35

Automatic tail call optimization is not supported as the JVM does not support it natively; it is possible to do so explicitly by using the recur keyword. Clojure_sentence_36

For parallel and concurrent programming Clojure provides software transactional memory, a reactive agent system, and channel-based concurrent programming. Clojure_sentence_37

Clojure 1.7 introduced reader conditionals by allowing the embedding of Clojure and ClojureScript code in the same namespace. Clojure_sentence_38

Transducers were added as a method for composing transformations. Clojure_sentence_39

Transducers enable higher-order functions such as map and fold to generalize over any source of input data. Clojure_sentence_40

While traditionally these functions operate on sequences, transducers allow them to work on channels and let the user define their own models for transduction. Clojure_sentence_41

Alternate Platforms Clojure_section_3

The primary platform of Clojure is Java, but other target implementations exist. Clojure_sentence_42

The most notable of these is ClojureScript, which compiles to ECMAScript 3, and ClojureCLR, a full port on the .NET platform, interoperable with its ecosystem. Clojure_sentence_43

A survey of the Clojure community with 1,060 respondents conducted in 2013 found that 47% of respondents used both Clojure and ClojureScript when working with Clojure. Clojure_sentence_44

In 2014 this number had increased to 55%, in 2015, based on 2,445 respondents, to 66%. Clojure_sentence_45

Popular ClojureScript projects include implementations of the React library such as Reagent, re-frame, Rum, and Om. Clojure_sentence_46

Other Implementations Clojure_section_4

Other implementations of Clojure on different platforms include: Clojure_sentence_47


  • CljPerl, Clojure atop PerlClojure_item_0_0
  • Clojerl, Clojure on BEAM, the Erlang virtual machineClojure_item_0_1
  • clojure-py, Clojure in pure PythonClojure_item_0_2
  • Ferret, compiles to self-contained C++11 that can run on microcontrollersClojure_item_0_3
  • Joker, an interpreter and linter written in GoClojure_item_0_4
  • Las3r, a subset of Clojure that runs on the ActionScript Virtual Machine (the Adobe Flash Player platform)Clojure_item_0_5
  • Pixie, Clojure-inspired Lisp dialect written in RPythonClojure_item_0_6
  • Rouge, Clojure atop YARV in RubyClojure_item_0_7

Popularity Clojure_section_5

With continued interest in functional programming, Clojure's adoption by software developers using the Java platform has continued to increase. Clojure_sentence_48

The language has also been recommended by software developers such as Brian Goetz, Eric Evans, James Gosling, Paul Graham, and Robert C. Martin. Clojure_sentence_49

ThoughtWorks, while assessing functional programming languages for their Technology Radar, described Clojure as "a simple, elegant implementation of Lisp on the JVM" in 2010 and promoted its status to "ADOPT" in 2012. Clojure_sentence_50

In the "JVM Ecosystem Report 2018" (which was claimed to be "the largest survey ever of Java developers"), that was prepared in collaboration by Snyk and Java Magazine, ranked Clojure as the 2nd most used programming language on the JVM for "main applications". Clojure_sentence_51

Clojure is used in industry by firms such as Apple, Atlassian, Funding Circle, Netflix, Puppet, and Walmart as well as government agencies such as NASA. Clojure_sentence_52

It has also been used for creative computing, including visual art, music, games, and poetry. Clojure_sentence_53

Tools Clojure_section_6

Tooling for Clojure development has seen significant improvement over the years. Clojure_sentence_54

The following is a list of some popular IDEs and text editors with plug-ins that add support for programming in Clojure: Clojure_sentence_55


In addition to the tools provided by the community, the official Clojure CLI tools have also become available on GNU/Linux, macOS, and Windows since Clojure 1.9. Clojure_sentence_56

Features by example Clojure_section_7

The following examples can be run in a Clojure REPL such as one started with the Clojure CLI tools or an online REPL such as one available on Clojure_sentence_57

Simplicity Clojure_section_8

Because of the strong emphasis on simplicity, typical Clojure programs consist of mostly functions and simple data structures (i.e., lists, vectors, maps, and sets): Clojure_sentence_58

Programming at the REPL Clojure_section_9

Like other Lisps, one of the iconic features of Clojure is interactive programming at the REPL. Clojure_sentence_59

Note that, in the following examples, ;; starts a line comment and ;; => indicates the expected output: Clojure_sentence_60

Names at runtime Clojure_section_10

Unlike other runtime environments where names get compiled away, Clojure's runtime environment is easily introspectable using normal Clojure data structures: Clojure_sentence_61

Code as data (homoiconicity) Clojure_section_11

Similar to other Lisps, Clojure is homoiconic (also known as code as data). Clojure_sentence_62

In the example below, we can see how easy it is to write code that modifies code itself: Clojure_sentence_63

Expressive operators for data transformation Clojure_section_12

The threading macros (->, ->>, and friends) can syntactically express the abstraction of piping a collection of data through a series of transformations: Clojure_sentence_64

This can also be achieved more efficiently using transducers: Clojure_sentence_65

Thread-safe management of identity and state Clojure_section_13

A thread-safe generator of unique serial numbers (though, like many other Lisp dialects, Clojure has a built-in gensym function that it uses internally): Clojure_sentence_66

Macros Clojure_section_14

An anonymous subclass of that doesn't write to anything, and a macro using it to silence all prints within it: Clojure_sentence_67

Language interoperability with Java Clojure_section_15

Clojure was created from the ground up to embrace its host platforms as one of its design goals and thus provides excellent language interoperability with Java: Clojure_sentence_68

Software transactional memory Clojure_section_16

10 threads manipulating one shared data structure, which consists of 100 vectors each one containing 10 (initially sequential) unique numbers. Clojure_sentence_69

Each thread then repeatedly selects two random positions in two random vectors and swaps them. Clojure_sentence_70

All changes to the vectors occur in transactions by making use of Clojure's software transactional memory system: Clojure_sentence_71

See also Clojure_section_17


Credits to the contents of this page go to the authors of the corresponding Wikipedia page: