Clojure 1.6
Written by Alex Armstrong   
Monday, 31 March 2014

Clojure is a dialect of Lisp that has attracted a following among programmers who want to adopt a functional approach. Version 1.6 introduces new and improved features, enhancements to performance, printing, documentation strings and error message plus bug fixes.

Originally developed by Rich Hickey to target the JVM, Clojure had since been ported to the CLR (clojure-clr) and another fork has resulted in a Clojure to JavaScript compiler, ClojureScript.

 

 

According to the description on clojure.org:

It is designed to be a general-purpose language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming. [It] shares with Lisp the code-as-data philosophy and a powerful macro system, is predominantly a functional programming language, and features a rich set of immutable, persistent data structures. When mutable state is needed, Clojure offers a software transactional memory system and reactive Agent system that ensure clean, correct, multithreaded designs. 

The new release provides a Java API consisting of:

clojure.java.api.Clojure
clojure.lang.IFn

This provides a minimal interface to bootstrap Clojure access from other JVM languages. It does this by providing: the ability to use Clojure's namespaces to locate an arbitrary var, returning the var's clojure.lang.IFn interface and a method read for reading data using Clojure's edn reader. IFns provide complete access to Clojure's APIs. You can also access any other library written in Clojure, after adding either its source or compiled form to the classpath.

It provides new hashing algorithms for primitives and collections, accessible via IHashEq/hasheq (in Java) or the clojure.core/hash function (in Clojure). In general, these changes should be transparent to users, except hash codes used inside hashed collections like maps and sets will have better properties.

It also introduces "some" operations, conditional functions that complement true and false when what you want to test is "not nilness".Three functions have been added: 

  • some? - same as (not (nil? x))
  • if-some - like if-let, but checks (some? test) instead of test
  • when-some - like when-let, but checks (some? test) instead of test

 

An update to map destructuring with :keys and :syms mot allow them to match namespaced keys and bind to a local variable based on its name.

 

 


clojure

The update to Clojure is welcome but introduction of Java 8 and is support for lambdas has provoked one or two programmers to wonder if Clojure is a good option any more. Of course it is if you are looking for a very dynamic functional language Clojure is still a good choice but it you previously were just a little irritated by the Java's support for some feature or another then perhaps its time to stick with Java 8. 

More Information

Clojure

Changes to Clojure in Version 1.6

Related Articles

Clojure 1.2 - hot off the press

Programming Clojure (book review)

Practical Clojure (book review)

Clojure in Action (book review)

 

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin,  or sign up for our weekly newsletter.

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info

 

Banner


Extend NGINX With The New JavaScript Module
28/10/2024

Inject middleware functionality into NGINX with the expressive power of Javascript. NGINX JavaScript or NJS for short is a dynamic module under which you can use scripting for hooking into the NGINX e [ ... ]



Remembering Thomas Kurtz, Co-creator of BASIC
15/11/2024

Thomas Eugene Kurtz, the co-founder of the BASIC programming language, has died at the age of 96. BASIC, which was developed for the purpose of education, popularized computer programming making it ac [ ... ]


More News

Last Updated ( Monday, 31 March 2014 )