FazBrowse Wikipedia Viewer | Main Page |
Search Wikipedia:
|
Viewing: https://en.wikipedia.org/wiki/ClojureScript

Clojure

Contents
History
Design
Extensible Data Notation
Alternative platforms
Tools
Development
Impact
Release history
Further reading

{{cite web |url=https://clojure.org/reference/agents |title=Agents and Asynchronous Actions |website=Clojure.org |access-date=2019-07-07}}</ref>\n* [[Concurrent programming|concurrent]]<ref>{{cite web |url=https://clojure.org/about/concurrent_programming |title=Concurrent Programming |website=Clojure.org |access-date=2019-07-07}}</ref><ref>{{cite web |url=https://github.com/clojure/core.async |title=core.async |last1=Hickey |first1=Rich |author2=((contributors)) |website=[[GitHub]] |access-date=2019-07-07}}</ref>\n* [[Functional programming|functional]]<ref>{{cite web |url=https://clojure.org/about/functional_programming |title=Functional Programming |website=Clojure.org |access-date=2019-07-07}}</ref>\n* [[Logic programming|logic]]<ref>{{cite web |url=https://github.com/clojure/core.logic/ |title=core.logic |last1=Nolen |first1=David |last2=Hickey |first2=Rich |website=GitHub |access-date=2019-07-07}}</ref>\n* [[Macro (computer science)|macro]]<ref name=\"reference/macros\">{{cite web |url=https://clojure.org/reference/macros |title=Macros |website=Clojure.org |access-date=2019-07-07}}</ref>\n* [[Pipeline (software)|pipeline]]<ref>{{cite web |url=https://clojure.org/guides/threading_macros |title=Threading Macros Guide |last=Esterhazy |first=Paulus |website=Clojure.org |access-date=2019-07-07}}</ref>\n}}"},"family":{"wt":"[[Java virtual machine|JVM]]-[[Hardware virtualization|hosted]]; [[Lisp (programming language)|Lisp]]"},"designer":{"wt":"[[Rich Hickey]]"},"released":{"wt":"{{Start date and age|2007}}"},"latest release version":{"wt":"1.12.6<ref name=\"clj-1.12.6\">{{cite web |last1=Miller |first1=Alex |title=Clojure 1.12.6 |url=https://clojure.org/news/2026/09/02/clojure-1-12-6 |website=clojure.org |access-date=2 November 2026 |date=2 September 2026}}</ref>"},"latest release date":{"wt":"{{start date and age|2026|09|02|df=yes}}"},"typing":{"wt":"{{flatlist|\n* [[Dynamic typing|Dynamic]], [[Strong and weak typing|strong]]\n}}"},"memory management":{"wt":"[[Garbage collection (computer science)|Garbage collection]] via a host ([[Java virtual machine|JVM]], [[Common Language Runtime|CLR]], a [[JavaScript]] runtime such as [[V8 (JavaScript engine)|V8]] in case of ClojureScript or [[BEAM (Erlang virtual machine)|BEAM]] (see [[#Alternative platforms|below]])"},"dialects":{"wt":"ClojureScript, ClojureDart"},"influenced by":{"wt":"{{flatlist|\n* [[C Sharp (programming language)|C#]]\n* [[C++]]<ref>{{cite web |url=http://www.codequarterly.com/2011/rich-hickey/ |title=Rich Hickey Q&A |last=Fogus |first=Michael |year=2011 |website=CodeQuarterly.com |archive-url=https://web.archive.org/web/20170111184835/http://www.codequarterly.com/2011/rich-hickey/ |archive-date=2017-01-11}}</ref>\n* [[Common Lisp]]\n* [[Erlang (programming language)|Erlang]]\n* [[Haskell]]<ref>{{cite web |url=https://youtube.com/watch?v=LKtk3HCgTa8 |title=Simple Made Easy |last=Hickey |first=Rich |year=2011 |website=YouTube}}{{better source|date=September 2024}}</ref>\n* [[Java (programming language)|Java]]\n* [[ML (programming language)|ML]]\n* [[Prolog]]\n* [[Racket (programming language)|Racket]]<ref>{{cite thesis |last=Bonnaire-Sergeant |first=Ambrose |title=A Practical Optional Type System for Clojure |publisher=The University of Western Australia |year=2012}}</ref>\n* [[Ruby (programming language)|Ruby]]<ref>{{cite web |url=https://cdn.oreilly.com/oreilly/booksamplers/9781449394707_sampler.pdf |title=Clojure Programming |website=OReilly.com |access-date=2013-04-30}}</ref>\n* [[Scheme (programming language)|Scheme]]\n* [[Wolfram Language]]<ref>{{cite web |url=https://www.amazon.com/gp/richpub/listmania/fullview/R3LG3ZBZS4GCTH |title=Clojure Bookshelf |website=Amazon.com |last=Hickey |first=Rich |archive-url=https://web.archive.org/web/20171003001051/https://www.amazon.com/gp/richpub/listmania/fullview/R3LG3ZBZS4GCTH |archive-date=2017-10-03 |access-date=2019-07-07}}</ref>\n}}"},"influenced":{"wt":"{{flatlist|\n* [[Elixir (programming language)|Elixir]]\n* [[Hy (programming language)|Hy]]\n* Janet<ref>{{cite web |url=https://janet-lang.org/ |title=Janet Language |last1=Rose |first1=Calvin |author2=((contributors)) |website=Janet-Lang.org |access-date=2023-02-18}}</ref>\n* [[LFE (programming language)|LFE]]\n* Pixie<ref>{{cite web |url=https://github.com/pixie-lang/pixie |title=Pixie |last=Baldridge |first=Timothy |website=[[GitHub]] |access-date=2025-02-06}}</ref>\n* Rhine<ref>{{cite web |url=https://github.com/artagnon/rhine-ml |title=Rhine |last=Ramachandra |first=Ramkumar |website=[[GitHub]] |access-date=2019-07-07}}</ref>\n}}"},"platform":{"wt":"{{flatlist|\n* [[Java (software platform)|Java]]\n* [[JavaScript engine|JavaScript]]\n* [[.NET]]\n}}"},"license":{"wt":"[[Eclipse Public License|Eclipse Public]]"},"website":{"wt":"{{URL|https://clojure.org}}"},"file ext":{"wt":"{{flatlist|\n* .clj\n* .cljs\n* .cljr\n* .cljc\n* .cljd\n* .edn\n}}"},"wikibooks":{"wt":"Clojure Programming"}},"i":0}}]}'>
Clojure
ParadigmMulti-paradigm:
Memory managementGarbage collection via a host (JVM, CLR, a JavaScript runtime such as V8 in case of ClojureScript or BEAM (see below)
Platform
Influenced

History

edit
Rich Hickey, creator of Clojure

Rich Hickey is the creator of the Clojure language. 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).

Hickey started working on Clojure in 2005 and spent about two and a half years working on Clojure before releasing it publicly in October 2007, much of that time working exclusively on Clojure with no outside funding. Stephanie Hickey, his wife, helped to design the language by a being an active listener and participating in discussions without writing any code. At the end of this time, Hickey sent an email announcing the language to some friends in the Common Lisp community.

Clojure's name, according to Hickey, is a word play 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.

Design

edit

Rich Hickey developed Clojure because he wanted a modern Lisp for functional programming, symbiotic with the established Java platform, and designed for concurrency. He has also stressed the importance of simplicity in programming language design and software architecture, advocating for loose coupling, polymorphism via protocols and type classes instead of inheritance, stateless functions that are namespaced instead of methods or replacing syntax with data.

Clojure's approach to state is characterized by the concept of identities, which are represented as a series of immutable states over time. 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. For this purpose, Clojure provides several mutable reference types, each having well-defined semantics for the transition between states.

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, too. The community uses tools such as Clojure command-line interface (CLI) or Leiningen for project automation, providing support for Maven integration. These tools handle project package management and dependencies and are configured using Clojure syntax.

As a Lisp dialect, Clojure supports functions as first-class objects, a read–eval–print loop (REPL), and a macro system. Clojure's Lisp macro system is very similar to that of Common Lisp with the exception that Clojure's version of the backquote (termed "syntax quote") qualifies symbols with their namespace. This helps prevent unintended name capture, as binding to namespace-qualified names is forbidden. It is possible to force a capturing macro expansion, but it must be done explicitly. Clojure does not allow user-defined reader macros, but the reader supports a more constrained form of syntactic extension. 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 has support for lazy sequences and encourages the principle of immutability and persistent data structures. As a functional language, emphasis is placed on recursion and higher-order functions instead of side-effect-based looping. 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. For parallel and concurrent programming Clojure provides software transactional memory, a reactive agent system, and channel-based concurrent programming.

Clojure 1.7 introduced reader conditionals by allowing the embedding of Clojure, ClojureScript and ClojureCLR code in the same namespace. Transducers were added as a method for composing transformations. Transducers enable higher-order functions such as map and fold to generalize over any source of input data. While traditionally these functions operate on sequences, transducers allow them to work on channels and let the user define their own models for transduction.

Extensible Data Notation

edit

Extensible Data Notation, or edn, is a subset of the Clojure language intended as a data transfer format. It can be used to serialize and deserialize Clojure data structures, and Clojure itself uses a superset of edn to represent programs.

edn is used in a similar way to JSON or XML, but has a relatively large list of built-in elements, shown here with examples: