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.

 

blog comments powered by Disqus

 

Banner


Google Drops Google Earth API
16/12/2014

Google isn't one to keep something it doesn't want hanging around just in case someone else still wants it. So another API bites the dust. You have one year to - do what exactly? There is no alternati [ ... ]



Qt 5.4 Released
12/12/2014

The latest version of the Qt framework has been released with revamped and renewed web support.


More News

Last Updated ( Monday, 31 March 2014 )
 
 

   
RSS feed of news items only
I Programmer News
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.