
Ask HN: Why should I care about Clojure? - smallegan
Everyone seems to be all up in arms about Clojure latley. Isn't this just another language? I have to admit I have not done any deep digging into what makes it so newsworthy which is why I am asking here...What am I missing?
======
yason
Clojure is a lisp and a lisp is rarely just another language.

If you don't know lisp or you don't want to know why you should know lisp, go
take Scala or Haskell or Python. If, however, you do know—or you're willing to
read a handful of Paul Graham's essays on lisp—let's continue:

Most importantly, Clojure is a lisp that is 1) not a toy, 2) not too
standalone without a supported platform, and 3) not Common Lisp.

1) Most lisps are toys. It is logical because lisps are fun, profound, and
nearly everyone (out of a certain demographic) has written a few. Then there
are various Common Lisps, Scheme lisps, Emacs Lisp, and then few others that
come as a part of some fairly important software library, and those aren't
toys but usable at least in some specific environments. Clojure is a full-
blown language that has actual development history past the "gee, i think this
is going to be interesting" phase.

2) libraries and compatibility are so important these days. The Python
language is gold because it has a fairly extensive standard library and
bindings to nearly everything, even if it isn't a lisp. Most lisps have
marginal effect and impact because they are so disconnected from the 2000's
state of affairs. They're only drawn from the chambers and wielded in
superimportant projects where the cost of building a suitable environment to
host the lisp system is negligible to the actual problem to be solved.

3) Common Lisp was a good, practical, multi-paradigm lisp by the 80's
standards. (Ok, path abstraction could've just worked everywhere right from
the start.) But the technology ship has sailed 15 years ago and CL wasn't on
it. So far, Common Lisp has been the best we lispers have got. But now that
there's Clojure, it doesn't matter we lispers weren't on the ship because with
Clojure we just got a jet flight to fifteen years in the future. And I don't
think we even saw the ship sailing below during our flight.

~~~
coliveira
Clojure is great if you happen to be tied to the JVM. It is fantastic to have
something usable on such an environment. However, outside that environment
there is little advantage compared to Common Lisp, since Clojure drags this
huge piece of crap that is the JVM. I would much prefer to have libraries in
the Python style -- that is, being able to connect to real, native object code
in several architectures.

~~~
swannodette
_Clojure drags this huge piece of crap that is the JVM_

What about the huge piece of crap that is the GIL? I mean come on. Clojure is
a good reason to care about the JVM. I'd completely given up on the JVM until
Clojure landed since there was no great way to tap into it's power without
adopting _Java's_ problems. The JVM rocks.

~~~
coliveira
Many of the problems of Java are inherited from the JVM: poor performance
compared to native code, long load times, funky classpath issues. Hell, Java
could even be a better language if it didn't _require_ a JVM (this is probably
what the Android guys think, too). I don't see why a Lisp needs to use it, if
is not for compatibility with existing Java code.

~~~
turtle4
The performance of the JVM is phenomenally good with any modern
implementation. The only issue remaining is the relatively poor loading time
of the JVM. Hence, short tasks/scripts make little sense to run because the
overhead of the startup overshadows the performance of the JVM.

But for long-running applications, the performance is very good, and the time
it takes to load doesn't really matter. The startup time mostly effects the
programmer, who has to start it up to debug the system so often. Clojure sort
of mitigates this by having a REPL where you can do testing/debugging without
restarting the JVM every time.

~~~
coliveira
This is the official truth, and I agree that it must be true when you talk
about benchmarks. But there is not application written in Java that I know of
that runs faster than a similar application written in C/C++.

All the Java applications that I am required to run are slow, and when they
perform well it is because they are using 10x the hardware required by a
comparable C++ application.

Of course, if you are creating a network-bound application this doesn't matter
much (I can even use Python or Perl for that), but when you want reasonable
performance (e.g., on desktop applications), this idea shows to be completely
wrong.

~~~
zaph0d
It's unfair to compare JVM performance with that of C/C++ ones. Given the kind
of high-level language that Clojure is, it doesn't matter if it's slightly
slow than a C program.

Today, developer time is more expensive than CPU time.

------
spooneybarger
Do you like lisp(s)? Do you like the flexibility it provides?

If no, you probably shouldn't care too much about clojure. There are other
languages which can help you with the same problems as clojure.

If yes,

do you find that Common Lisp is carrying too much legacy baggage?

or

that the various lisps lack the libraries you need?

or

that you can't use lisp for the jobs you want to because the infrastructure is
considered too esoteric by those you answer to?

If yes to any of those,

clojure runs on top of the jvm and can be installed in a normal jvm
infrastructure which many companies already run. It interoperates quite well
with java so you have a vast array of existing libraries. it removes a lot of
legacy burden that many lisps have.

that would be my quick primer on why you might care.

~~~
swannodette

      > Do you like lisp(s)? Do you like the flexibility it provides?
    

You don't have to like lisps to like Clojure. In fact it's just irrelevant.
There are plenty of people in the community for whom Clojure is their first
lisp.

The questions should be:

    
    
      * Do you like dynamic languages ?
      * Do you interactive languages ?
      * Do you hate wasting time recompiling your entire program 
        in your static language for a small change?
      * Is your dynamic language too slow ?
      * Do you want concurrency to be like child's play ?
      * Are you tired of depending on immature libraries ?
      * Do you want an evented webserver like Node.js that 
        doesn't force you to write callbacks?
      * ... etc ...
    

Your list is the completely wrong set of questions to be asking when
considering Clojure.

EDIT: it's not that Clojure being a Lisp is not important. It's just not the
first question I would ask myself when considering to adopt. My questions are
specific to the process by which I want solve problems in a particular domain.
The fact that is getting upvotes shows just how surface of an assessment
people make when looking at Clojure - "Oh ... it's a Lisp".

~~~
m0th87
This reads like:

    
    
      * Do you like puppies?
      * Do you hate murder?
      * Would you like something like the tool you're using right now, but better?
    

That's not to say Clojure is irrelevant, but your questions are more than a
little one-sided.

~~~
swannodette
Except I have answers for those questions. And those influence my decisions in
real life. I like puppies. And I abhor murder.

Anyways, my questions are exactly the set of questions that led me to Clojure.
Honestly, the main advantage of Clojure being a Lisp is macros. And I didn't
bother mentioning those, because that's not something most programmers
need/want (not without understanding how they work).

I think my list a pretty _real_ list of things that many programmers want
after some experience that Clojure satisfies that other languages do not, or
not all at the same time.

------
KirinDave
It's a modern lisp with exceptionally good concurrency primitives. Unless
you're an Erlang programmer, you will be hard-pressed to find a library that
gives you such effortless multiple-core options.

While this is more opinion than strict fact, characterizing Lisp as "just
another language" is a terrible mistake. Lisp's utterly malleable syntax and
exceptionally good semantics make it a very powerful language, one of the few
that has managed to keep reviving over and over despite massive change in our
industry.

It's very unfortunate that modern programmer culture has taken so long in
America to catch up with what Academia has been arguing for years: functional
programming matters. Lisp has an even more obscure thesis: semantic
customization matters. Clojure strikes a good balance in this regard; it does
not ask the programmer to do much macro programming and many of the things you
need are already written.

~~~
WilliamLP
> It's very unfortunate that modern programmer culture has taken so long in
> America to catch up with what Academia has been arguing for years:
> functional programming matters.

This kind of rhetoric is found on all programming discussion boards. What
seems strange to me is what isn't expressed, especially in a place like this
originally oriented toward real-world start-ups.

Someone who believed this and had an entrepreneurial spirit wouldn't think it
was "unfortunate". They would be positively salivating and would think this
fact was _fantastic_. If functional programming matters in the industry,
what's stopping you from using it, and the parts that make a difference, to
tackle some problems and solve them in a more effective and profitable way
than your competitors?

Yes, fine, nobody will hire you. Well save up some ramen money and do it
yourself. What am I missing? If all of the people who use this "functional
programming matters" rhetoric really and truly and passionately believe this,
they would accomplish proving their belief, benefiting the programming world
as a whole, and making some fantastic profit in the process. Why don't I see
more of this attitude (or barely any of it at all) from functional
enthusiasts? What am I missing here?

~~~
starkfist
What are you talking about? Most of the startups discussed on this forum
and/or funded by YC are using some subset of functional programming.

~~~
WilliamLP
We're all (almost) using some subset of functional programming. (Even working
in something like PHP.) We're also almost all not using Lisp, Haskell or even
Scala. Lisp had brilliant ideas that became mainstream and widespread; that is
not contestable.

~~~
KirinDave
There are still many more brilliant and powerful ideas from Common Lisp that
have not been adopted, despite being demonstrably superior. Hopefully everyone
else can catch up so your pronouncement of Lisp's death can be made true.

Want an example? Condition handlers and restarts; no one else does this as
well as Common Lisp did in the early 90's.

------
marcusbooster
I wanted to learn a Lisp so I started with Clojure thinking it would be the
more practical choice. Unfortunately, I found that for every 1 part lisp I was
learning I had to learn 2 parts Java, which kinda defeated the purpose of my
goal of learning a lisp in the first place.

I switched to Common Lisp and have been happy. There are some really great
books for it and it's helped my overall programming skill. If I had to work
with Java I would consider Clojure, but I didn't find it a particularly
enlightening language, at least if you're trying to learn Lisp.

~~~
spooneybarger
To others in a similar position: if you want to learn a lisp, I think racket (
aka plt scheme ) would be the easiest introduction.

~~~
tmountain
Racket is great, and I'm not trying to pick nits, but it's not a Lisp, it's a
Scheme dialect. If you want to learn pure Lisp, I'd recommend Paul Graham's
book, On Lisp, which is available online for free.

<http://www.paulgraham.com/onlisp.html>

~~~
amalcon
Scheme is a Lisp; it's just not a Common Lisp.

~~~
fogus
Not advocating either way, but it was always (and still is) interesting to
read what Erik Naggum had to about Scheme's Lispiness:
[http://www.xach.com/naggum/articles/search?q=%22scheme+is+a+...](http://www.xach.com/naggum/articles/search?q=%22scheme+is+a+lisp%22&sort=of)

------
masterponomo
The energy to do deep digging?

Seriously, clojure.org includes a rationale for the language. Maybe you should
give that a look. If you care about any of the points in the rationale, and if
Clojure delivers on those points, then you may be in the ballpark of caring
about Clojure.

~~~
Sapient
The range of opinions which you access by posting a question like this on HN
can have more value than the rationale page on the Clojure website.

That is to say, the reason for asking a question like this is not always
laziness.

~~~
technomancy
Might be true of the rationale page, but <http://clojure.org/state> is far
more insightful than anything you will find in your average HN thread.

------
arete
Lisp-style languages give you homoiconicity and macros which allow you to
build complex abstractions. For example you can write (with-resource x
(do....)) where with-resource handles resource allocation and cleanup. That
particular example can of course be done with decorators in Python or blocks
in Ruby but lisp macros go further by letting you rewrite code at compile
time.

Clojure itself has better solutions to common shared-state concurrency
patterns than other lisps (and most languages in general!): efficient
persistent data structures, STM, various atomic reference types, etc.

And of course running on the JVM has many benefits: performance via the
excellent JIT and GC, high quality libraries, great development and operations
tools, and so on.

------
francoisdevlin
Here's what Rich Hickey (our BDFL) has to say:

For veteran lisp hackers <http://clojure.blip.tv/file/1313398/>

For people just finding lisp <http://blip.tv/file/982823>

------
ifesdjeen
same thing happened to Ruby as well. and to Python. and to Java. .net is a
different thing, lot people were just forced into it.

before the vast majority really accepts some technology, early adopters come
in. they figure out better ways of doing stuff. until someone has a success
story, people doubt new technologies. Ruby brought us a great object model and
introduced a lot of perl / php people, or simply web developers shifting from
anything else to metaprogramming. probably, until i faced Ruby, coming from
.net / java background, i didn't know (that much) about it. neither about
dynamic typing.

closure is - yet - another language, that's quite true. we don't speak much of
a performance here (even though it seems to be great), hence it does introduce
us to functional programming and makes us think differently about objects and
persistence. it doesn't mean that you have to quit your job and start looking
for haskel / closure / scheme / lisp job. it means that you _may_ benefit just
from knowing how stuff works there.

remember s-expressions in Lisp? they nicely fit into .net expression trees, no
surprise. smalltalk object model did work for Ruby. you may benefit from
traits from scala in your Ruby code. and so on.

so, until there's some success story and bunch of libraries / great codebase /
frameworks for development, most of people will stay aside. though you have a
chance to get into the crowd :)

~~~
zaph0d
The language name is spelled as `Clojure' and not `Closure' (note the J).

------
d0m
Lots of people regard lisp language as toys or "scientists" languages that
isn't usable in the real world to solve real problem. (It might not be the
opinion on hacker news, obviously). So, then, come clojure which is a lisp
based language that is smartly integrated with the java platform.. so now, you
get the power of lisp with the usability and friendliness of java.

~~~
spooneybarger
i dont find java to be very friendly.

i find boilerplate and attempts to protect me from myself to be the opposite
of friendly. i also find jvm infrastructure to be less easy to deal with than
the infrastructure that many other languages have.

i would replace 'friendliness of java' with 'breadth of support for'.

~~~
amalcon
It's friendly in more the social/cooperative sense than the sense that it's
easy to work with in itself: there are a lot of very good libraries, the
runtime is pretty much fully baked, and you get a wide choice of development
tools.

~~~
spooneybarger
So there is a breadth of support you don't get elsewhere? I wouldn't argue
with that. When it comes to breadth of support, it is hard to argue against
java, php etc.

------
Tichy
It could be a reasonably fast language that is pleasant to use and that has
lots of libraries (via the Java world), which is a rare combination.

Also perhaps if you are stuck in Java land, it might provide a means to
escape.

~~~
Zak
It is important to point out that many of those Java libraries are not
pleasant to use, to the point that I once found it easier to write a basic CSV
library in Clojure than to interface with any of the Java CSV libraries I
could find.

It's still a significant advantage to have the option, and some of the Java
libs aren't so bad.

~~~
Tichy
I admit that since I am tired of Java, so far I have shied away from trying
Clojure because at the end of the day, I figure I should rather try one of the
other interesting languages that are completely independent of Java.

It's a shame that apparently Clojure does not run well on Android yet. If you
are forced to use Java (as is the case on Android), Clojure would probably be
really sweet.

~~~
Zak
Rumor has it Scala works quite well on Android, but no dynamic language does
yet.

------
rosejn
I've had more eye opening experiences programming in Clojure than in any
language I learned before it. (C, C++, Java, Python, Ruby, common lisp) It
provides a fairly unique set of tools that really let you boil programs down
to their essence: persistent data structures, software transactional memory,
and an amazing standard library for operating on maps, sets, and sequences.
Instant access to Java libraries means it isn't just about academic beauty.

To each their own, but I highly suggest you take a weekend and experiment. You
won't regret it.

------
WilliamLP
I'm waiting for more than a few cherry-picked examples of people who talked
their boss into letting them use it, and academic papers, to be interested.
Clojure start-ups using it as a competitive advantage to make money competing
against others trying to solve similar problems would be very very
interesting. Some people seem to believe that its constructs for dealing with
concurrency have such potential, but on the other hand I can't tell if any of
this is real or cult-like hype. (Flame bait: look how excited people were
about Haskell a couple of years ago, and to some extent still are.)

My suspicion is that it is as close to a proven fact as you get in technology
that real-world business programmers don't want Lisp. Yet it creates unequaled
excitement and enthusiasm, as it has for half a century. A whole generation of
top programmers trained at places like MIT were trained in Lisp from the very
beginning. It had a firm foothold in places like Nasa. Yet how many of these
programmers now use Lisp in the industry? I don't think very many, especially
relative to the amount of enthusiasm people have for it. Lack of education and
exposure and trials has most emphatically not been the issue here. Do the lead
engineers at Google let their employees use Lisp? No. Now do all of you know
something they don't or is it the other way around? Was Paul Graham's genius
(as a programmer who spent his formative years learning BASIC) to use Lisp or
was he a brilliant person with an ingenious idea to build a customizable
online store in the mid 1990s and could have succeeded in any language? It
seems to me that Lisp is so old and has failed to maintain a real foothold in
the industry for so long that these questions demand answers. Postulating that
maybe there are companies using Lisp _in secret_ doesn't cut it here.

As a side note, one of Paul Graham's famous essays has a bizarre pieces of
logic that goes "If Lisp makes you a better programmer, why not use it all the
time?" It does not follow. Swinging a weighted bat might make you a better
hitter, a ballroom bar might make you a better dancer, training at high
altitudes might improve your cardio.

I close with this interesting quote from Tim Sweeney:

 _"Of course, it's easy to see how this undercurrent arises. When you release
a language, you receive complaints from users about all the things they want
to do and can't, and the ultimate way to satisfy all of these requests is to
expose all metadata: make it extensible, make objects dynamic, and allow the
possibility of completely dynamic typing. The end of the road here looks an
awful lot like LISP and SmallTalk._

 _"If you go this route, one day you'll realize you evolved the ultimate
hacker language, and it became a godawful mess for writing real programs."_

~~~
swannodette
_"If you go this route, one day you'll realize you evolved the ultimate hacker
language, and it became a godawful mess for writing real programs."_

A Stradivarius (a kind of ultimate hacker tool) in the hand of a master can
change people lives. A Stradivarius in the hand of a lesser musician will
probably still sound pretty good. A master with a second hand violin can still
move us. A busted up violin can't be made to sound good.

There's a lot of coders out there with second-hand violins. I wonder what they
could do if they all had the Stradivarius. In real life there is physical
scarcity, in the world of code the scarcity is a product only of our lack of
curiosity and drive.

~~~
cageface
You'd think experienced engineers would know better than to say language A is
categorically better than language B when the one thing real-world programming
experience should teach you is that context is everything. Any engineering
solution is a careful balance of tradeoffs and language design is no
different.

In order to take this conversation in a more adult direction we should ask
this: What the advantages and disadvantages of s-expr syntax, a jvm foundation
and a pure functional core? What problems are made easier to solve by these
features? What problems are made more difficult to solve by these features?
What are the key tradeoffs vs the alternatives?

If you're one of those people that think FP is a silver bullet you're a
missionary, not an engineer.

~~~
swannodette
It's just a metaphor, take or leave it.

------
mbenjaminsmith
My two $0.02. I just built a small project in Clojure/Compojure. In this
particular project the JVM, not the language, proved to be a bad fit (so I
rewrote it in another language).

Clojure (and possibly other Lisps) feels kind of like Vim to me. It's harder
to understand at first, often un-intuitive, but I get the feeling that if I
took the time to learn it I would have a new powerful tool that saved me a lot
of time down the road.

I'm sure there are performance/capability reasons why it is a good language,
but for me the terseness is it's most attractive aspect.

~~~
philwelch
"Clojure (and possibly other Lisps) feels kind of like Vim to me."

Which is ironic because they keep suggesting to learn Emacs alongside Clojure
and other Lisps!

~~~
mhd
"They"? VimClojure seems to be pretty popular. Most people who use Clojure and
Emacs combined already used Emacs for other Lisp programming projects before,
so it definitely depends on the direction you're coming from. Java refugees
tend to stick to Eclipse.

The real irony is that there's barely any distinction between vim and emacs.
The "editor wars" included a lot of size arguments, but with the rising
popularity of vim as the de facto default vi (and increasing memory capacity),
this is a pretty moot point. Vi have become ze enemy.

(The number of people who stick to a smaller vi is probably the same as uemacs
users)

------
anon42389475
How does Haskell compare to Clojure? Arbitrarily, I started with Haskell, and
I have found it fascinating but very hard to apply to daily problems (given
the difficulty of IO).

~~~
spooneybarger
Another quick one on this, that doesn't address all questions...

a couple big differences:

syntax is totally different. clojure is a lisp. haskell has more in common on
a syntax level with ML ( amongst others ).

clojure runs on the jvm. haskell doesn't.

clojure is a dynamically typed language. haskell is statically typed.

------
gtani
There's been some long, impassioned threads here (YC), stackoverflow, reddit,
Lambda-ultimate. I invite you to dig deeper. You can't summarize a language's
spec, implementations, libraries, community and tool support very well in a
2000 word blog post.

<http://searchyc.com/clojure?sort=by_points>

[http://groovyguts.wordpress.com/2010/01/08/10-reasons-to-
lea...](http://groovyguts.wordpress.com/2010/01/08/10-reasons-to-learn-
clojure-or-any-other-lisp/)

[http://stackoverflow.com/questions/2120946/what-kind-of-
appl...](http://stackoverflow.com/questions/2120946/what-kind-of-applications-
are-appropriate-for-clojure)

\---------------

<http://news.ycombinator.com/item?id=1072822>

<http://news.ycombinator.com/item?id=1074136>

<http://news.ycombinator.com/item?id=1089139>

<http://news.ycombinator.com/item?id=1167820>

