Wednesday, 9 February 2011

Clojure enters the UK job market

According to the IT Jobs Watch website, the relatively new Clojure programming language has blasted onto the UK job market scene going from a single job advert a year ago to nine job adverts mentioning Clojure today, continuing to show healthy growth not only in the absolute number of jobs but also in market share (0.015% of all job ads mention Clojure). Remarkably, the most common salary for Clojure jobs is £90,000!

Perhaps Clojure can follow F#'s lead, which recently tripled its share of the job market in just four months.

Monday, 2 August 2010

Clojure in Healthcare

A software developer in a healthcare company recently wrote the following description of their use of Clojure from their background with Java:

It's really easy to integrate into existing infrastructure in a Java shop. You can package libraries in it as jars that can be used from java code, you can build it with the same tools, such as ant and maven, and Eclipse support for it is quite good. Clojure applications can be deployed on app servers like Websphere or Tomcat, so in that regard it hasn't really required any changes to the way we already do things.

As a language it definitely allows for writing much shorter code, and it's easier to unit test, as it encourages writing small functions, the expressiveness of the language has been rather welcome, and the concurrency support in it makes life much easier for us. Overall we find it to be a very solid alternative to using Java for web applications.

The only negative so far has been the syntax, most people are not familiar with Lisp, and not everybody can pick it up easily. So, that certainly presents a problem for some people, but we've got a critical mass of developers interested in it to do a pilot project. So far the project has been going well and it is helping illustrate the benefits of using the language.

Even though we do not use Clojure, we have also noticed an increasing number of people referring to the Clojure language and that can only mean one thing!

Thursday, 16 July 2009

Fragile predicates with Java's booleans

Interoperability with the JVM is a wonderful thing but it can be the root of some surprises. The following seemingly innocuous Clojure snippet produces a surprising result:

user=> (if (Boolean. false) "true" "false")

Specifically, we used a predicate that appears to be false but the true branch of the if expression was taken. This occurs because Clojure uses a boxed representation of booleans that is incompatible with Java's. Combined with Clojures dynamic typing, this causes Java's false to be interpreted as not Clojures false and, therefore, true.

The solution is to box Java booleans in order to obtain a Clojure boolean:

user=> (if (boolean (Boolean. false)) "true" "false")

Sunday, 8 February 2009

Tail calls on the JVM: work in progress

The terms proper tail recursion and tail call elimination are used to describe the ability for a computation to flow through an arbitrary number of functions via tail calls in a bounded amount of stack space. Consequently, correct implementation of tail call elimination has been regarded as an essential feature for functional programming languages for over two decades. Without it, many functional idioms are prone to causing stack overflows.

Microsoft's .NET platform is built upon a Common Language Run-time (CLR) that was designed to support a wide variety of programming languages including functional languages and, consequently, the CLR has had tail call elimination for the best part of a decade. There are already several commercial products that depend upon the correct handling of tail calls in the CLR.

Although the JVM has many advantages and is the VM of choice for millions of developers, the lack of support for tail call elimination on the JVM has seriously impeded the development and uptake of functional languages like Scala and Clojure and that has, in turn, greatly reduced the diversity of tools and solutions available on the JVM.

Sun have been making noises about implementing tail call elimination in the HotSpot virtual machine for years but there had been no visible signs of progress until Arnold Schwaighofer's announcement on the OpenJDK mailing list a few weeks ago stating that he had successfully implemented tail call elimination on the JVM.

This is very exciting news and represents the single most important step the JVM has ever made toward being a genuine common language run-time. If support for tail call elimination makes it into the JVM then both existing and new functional languages (such as OCamlJava) will no doubt see vastly more interest as they will be infinitely more suitable for writing production quality code.

Friday, 30 January 2009

Welcome to Clojure News

Welcome to our new functional programming news blog specifically for the Clojure programming language. Clojure is a dynamic programming language derived from Lisp that targets the JVM. In particular, Clojure takes core features of Lisp such as macros and functional programming and adds extensive state-of-the-art support for parallel and concurrent programming, building upon the JVM's world leading performance.