Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been taking a look at Clojure lately and I stumbled upon this post on Stackoverflow that indicates some projects following best practices, and overall good Clojure code. I wanted to get my head around the language after reading some basic tutorials so I took a look at some "real-world" projects.

After looking at ClojureScript and Compojure (two the the aforementioned "good" projects), I just feel like Clojure is a joke. I don't understand why someone would pick Clojure over say, Ruby or Python, two languages that I love and have such a clean syntax and are very easy to pick up whereas Clojure uses so much parenthesis and symbols everywhere that it ruins the readability for me.

I think that Ruby and Python are beautiful, readable and elegant. They are easy to read even for someone who does not know the language inside out. However, Clojure is opaque to me and I feel like I must know every tiny detail about the language implementation in order to be able to understand any code.

So please, enlighten me!

  • What is so good about Clojure?
  • What is the absolute minimum that I should know about the language in order to appreciate it?
share|improve this question

closed as not constructive by Robert Harvey, Walter, Thomas Owens Dec 12 '12 at 0:46

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

I don't understand why someone would pick Clojure over say, Ruby or Python - it runs on the jvm and can use the entire java library. ... have such a clean syntax arguably, lisp like functional languages have a very clean syntax and structure, its just one most people aren't used to. – user40980 Dec 11 '12 at 21:12
Its name is sexy. – Jason Dec 11 '12 at 21:12
Any teenager living in a basement can pick up Python and Ruby in a matter of few months. If that is all they ever want to use, then they will never get out of the basement. I am not saying that someone who has done professional Python development for many years is a lesser mortal comparing to someone who writes embedded C, but if Python and Ruby is all they know and all they ever want to know, then something is fishy. By the way, it took me personally over 6 years after graduating to discover and appreciate functional programming and Lisps. My first reaction to Scheme was a knee-jerk. – Job Dec 11 '12 at 22:22
"arguably, lisp like functional languages have a very clean syntax and structure, its just one most people aren't used to.": I have very little experience with Lisp and I have just started to read the book "Practical Common Lisp". So far, I haven't encountered any problems with the syntax; IMHO the myths about Lisp-like syntax being less readable are just FUD. – Giorgio Dec 11 '12 at 22:34
I started looking at Clojure recently (but I have prior experience with Haskell and Scala, so the syntax isn't such a shock). I actually found it surprisingly readable. There are very few symbols outside of parenthesis compared to many languages, and almost no reserved words. The reason you find it unreadable is because it's a totally new paradigm and works in a fundamentally different way than a typical Object Oriented language. Give it some time and power through. – KChaloux Dec 12 '12 at 13:54
up vote 32 down vote accepted

For the background you gave, if I may paraphrase:

  1. You're familiar with Ruby/Python.
  2. You don't see the advantages of Clojure yet.
  3. You don't find either Lisp or Clojure syntax clear.

...I think the best answer is to read the book Clojure Programming by Emerick, Carper and Grand. The book has numerous explicit code comparisons with Python, Ruby, and Java, and has text explanations addressing coders from those languages. Personally, I came to Clojure after building good-sized projects w/ Python, and having some Lisp experience; reading that book helped convince me to start using Clojure not just in side-projects but for professional ends.

To address your two questions directly:

  1. What's so good about Clojure? Plenty of answers on this site and elsewhere, e.g. see
  2. What is the absolute minimum that I should know about the language in order to appreciate it? I'd suggest knowing the big ideas behind Clojure's design, as articulated in both Clojure Programming and The Joy of Clojure books-wise, and in Rich Hickey's talks, esp. the talk Simple Made Easy. Once you know the what/why you can then start understanding the how when reading Clojure code, esp. how to change your thinking from classes, objects, state/mutation to "just functions and data" (higher-order functions, maps/sets/sequences, types).

Additional suggestions: Lisp's elegance and power is partly from its minimalist and utterly consistent syntax. It's much easier to appreciate that with a good editor, e.g. Emacs with clojure-mode and ParEdit. As you get more familiar with it, the syntax fades away and you'll "see" semantics, intentions, and concise abstractions. Secondly, don't start by reading the source for ClojureScript or Compojure, those are too-much-at-once; try some problems, and compare solutions with the top coders there. If you see 4-6 other solutions, invariably someone will have written a truly idiomatic, succinct FP-style solution which you can compare with a clumsy, verbose, and needlessly complicated imperative-style solution.

share|improve this answer
"What's your reason to learn Clojure?" link is broken. – ravi404 Apr 24 '15 at 14:14
That link/page seems to have been completely deleted. Likely another over-zealous editor action here at stackexchange, willfully destroying community knowledge. Updated with another link, thanks for the heads-up. – limist Mar 21 at 13:20

Lisp dialects have a unique niche due to their simple syntax. This simple syntax makes meta programming through the use of macros very simple. This allows you to model the language to suit your problem domain instead of modeling to fit your problem domain into your language. It's really cool once you get your head around it, and it lets you do a lot of things easily that is very difficult in other languages.

The downside, is that since every Lisp program essentially defines its own language, you really need a solid grasp on things to understand what is going on.

Now, to answer your questions...

  1. Closure is a modern Lisp dialect that runs in the JVM/CLR. This makes it easy to take advantage of the power of Lisp in an existing infrastructure.

  2. It is essential to understand how to use macros to build Lisp to your problem domain to appreciate its usage. I really only understood this after implementing a Lisp runtime, when I found that much of the core language features can easily be implemented in Lisp itself. It takes a fair sized project to get this.

Now its pluses aside, although it is fun to program in, I personally don't have many cases where I would turn to it for daily problems. It is a very good tool to learn for mind expansion, and after learning Lisp properly, it became much more natural to take advantage of meta programming facilities in other languages.

The simple syntax makes it easy for computers to interpret (allowing such easy powerful macros), but it makes it very difficult for a human to parse complex expressions quickly.

share|improve this answer
Have you looked at light table‌​? – user40980 Dec 11 '12 at 21:51
Your answer makes it sound like macros are the normal way to approach Lisp programming, when in fact most programming problems can be solved with ordinary, first-class functions. Macros are intended primarily to be used for language programming (i.e. extending the language). See also – Robert Harvey Dec 11 '12 at 22:11
@RobertHarvey I would argue that if you aren't taking advantage of marcos, then there are a plethora of other languages that I would turn to which offer first-class functions with a much more readable syntax. – bunglestink Dec 11 '12 at 22:23
@MichaelT that looks neat. I like the concept. – Jubbat Dec 11 '12 at 23:25
@RobertHarvey Scala, JavaScript, C#, Python, and Haskell are all on the top of my head as far as languages with first class functions that I would consider more human-parsable syntax than Lisps. – bunglestink Dec 12 '12 at 5:11

The strengths of Clojure have been highlighted many times, and, sure enough, make for a very powerful language, so I won't repeat them again here.

I always loved lisp, since the uni days and I was really excited when I discovered Clojure (perhaps the chance of using lisp outside of academia at last!). However as I started learning an uneasy feeling has begun to creep in, though I cannot pinpoint exactly what it is that I don't like. First of all I would say that coding in Common lisp was easy and fun for me but Clojure has a steeper learning curve. Clisp had a certain beauty and elegance to it. I'm not sure I'll get the same feeling from Clojure. I'm wondering if that feeling will go away as I get more experience.

I have another guess for my mysterious slight repulsion. I think it might be its great flexibility. For instance you can have structures that are half vector and half map and with a few characters of code you can accept them as parameters, take them apart and process them correctly. Yes, it removes all the boilerplate, but somehow it doesn't feel right. Is like you never know very well the rules under all those parenthesis, colons, brakets, etc are operating.

For me, I still love the language for all its advantages (primarily, running in the JVM and simplifying concurrency, while being much more powerful, and concise than Java and with less obvious design flaws) but the jury is still out as to whether something could have been improved.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.