6 New Programming Languages you should get to know

2. Clojure

New Programming Languages - Clojure

Clojure (born in 2007) is one of the several languages built on the virtualisation part of Java, the JVM, making it compatible with Java code and the Java runtime environment.

Clojure compiles to Java and there is another version implementation, ClojureScript, which compiles to JavaScript.

Clojure doesn’t look anything like Java or JavaScript. There are no curly braces ((((( but in their place are lots of parentheses ))))). You tend to read statements right-to-left rather than left-to-right, so to add 2 and 3 you write (+ 2 3), and you use recursion in place of loops.

Clojure is a Lisp (List processing) language meaning that it treats data and the code itself as linked lists and tends to make a lot of use of macros.

This code fragment computes the sum and product of an array of integers:

Clojure – sum and product of an array

(defn sum [vals] (reduce + vals))
(defn product [vals] (reduce * vals))

Reason To Learn:

If you want to flirt with functional programming (FP) but don’t want to go all the way. functional programming makes the most of the ability of modern multi-core processors to support concurrency, but pure FP languages like Haskell are too much of a leap for some.

Clojure is a general-purpose language, like Java, with which it is compatible. Unlike Java, though, the syntax is simple, consistent and concise. Plus you can interact live with a running program to see what the separate functions do rather than having to recompile and run it after every change.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.