My initial investigations into Clojure left me sort of, stumped. The difference even in semantics alone is enough to completely put you off investing your precious spare time into attempting to understand it! What on earth is reverse polish notation? And why is literally everything wrapped in parentheses? Hopefully, this article will help demystify this obscure yet purely elegant language.
As I previously mentioned, almost everything in Clojure will seem downright bewildering to the majority of software developers. With its Lisp-uresque dialect, it truly allows for a more expressive experience, which, with enough time to master, will provide joy to the majority of programmers who are truly passionate about the quality of their code.
To start off, everything in Clojure is evaluated in a uniform structure (or rather, as Forms). That is, it recognises expressions in both literal (i.e defining a map or a vector) and operational formats. For example:
A few things to observe:
Of course, the examples above do not give the language justice in any sense; Clojure has a large variety of native simple types and intuitive data structures.
This is all great and fine for a REPL, but what about actual programs? What do we do when we have a particular piece of functionality in mind? Functions that's what!
In the operational examples above I also forgot to mention one thing: and that was the calling of the native Clojure function; first. Clojure has a large number of native functions, but what about defining our own functions? Here's a good basic example of defining functions:
Clojure as a language provides a unique way to write complex applications. It provides an elegant, powerful syntax which makes complex applications seem trivial to write. There is a LOT more that can be said about Clojure, but to get started in writing Clojure head to Try Clojure to start a REPL, and writing awesome stuff! If you're like me and like to get straight into reading about Clojure, I'd highly recommend Clojure for the brave and true (http://www.braveclojure.com/); a fantastic read to really get to grips (and it's also free to read online).
Back to Blog