This is a mirror of official site: http://jasper-net.blogspot.com/

What is Clojure ?

| Monday, August 23, 2010
This was originally a reply to some people in a thread asking me to explain what Clojure was and give a "Clojure Rocks" speech. After I wrote this, I decided to put it here so that I could link to it rather than have to reiterate myself in the future for these sorts of questions. So here it is, in all it's glory. Enjoy


Clojure is a new language. It's a modern Lisp on the JVM (and the CLR).

The language is built for concurrency and features a software transactional memory model built into the language. Clojure is known for making concurrency-related tasks a total breeze.

Clojure is a functional programming language. Clojure offers pretty much everything you'd expect out of a functional language. Lambdas, closures, a wide variety of collection types and a huge sequence library for working with them. It also gives you plenty of the good of OOP while keeping out the bad. Clojure offers polymorphism through extremely powerful multimethods. The polymorphism that Clojure offers through multimethods, protocols, and records is more flexible than what you'd expect in most object oriented languages. Clojure doesn't shun object orientation as a whole, and takes what Clojure can benefit from. Immutability is the default in Clojure, but Clojure isn't a purely functional language. Rich Hickey recognizes that, while functional programming is good, purely functional programming isn't always best for every task. Some things just scream I/O and mutability, and Clojure provides ways to do these things and remain concurrent easily.

Clojure is a Lisp, which means that it has a macro system. While macros are a little difficult to understand/comprehend at first, they're extremely powerful tools to have at your disposal. Things that would have to be added by compiler writers in languages like Java can usually be added to Clojure by writing a macro. If Clojure is missing a feature that you want, you can quite literally write it yourself. Being a Lisp also means the syntax is very minimal. There isn't much to remember. The parentheses can be a little offputting for a while, but you eventually get used to them, and decent editor support can make them disappear entirely.

Read more: <dream-in-code>

Posted via email from .NET Info

0 comments: