11 ms·
Ask HN: Why should I care about Clojure?
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?
- spooneybarger 16y agoDo 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 16y ago> 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 16y agoThis 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 16y agoExcept 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.
- francoisdevlin 16y agoI would like a better tool than the one I am using to kill puppies right now.
- Raphael_Amiard 16y agoOr it may be that clojure truly rocks ;)
- winthrowe 16y agosince Clojure is a lisp, how can you like Clojure without liking lisp in the abstract? Clojure might be someone's first exposure to lisp, but then they would answer "I don't know if I like lisp or not".
- cema 16y agoLearning Clojure is a good way to like lisp.
- spooneybarger 16y ago
- d0m 16y agoLots 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 16y agoi 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'.
- tomjen3 16y agoCompared to many of the alternatives, Javas is very friendly. There aren't too many ways you can shoot yourself in the head, and it mostely does what you would expect it to do.
- spooneybarger 16y agoWe have a difference of opinion on what is 'friendly'. I don't consider protecting me from shooting myself in the head to be 'friendly', I would call that 'paternalistic'. I would call allowing me to easily express what I want 'friendly'. I find lisps, smalltalk and their brethren to be friendly under my definition.
- d0m 16y ago(As the author of the first comment), I said friendly in the sens beginner-friendly. Where they are a tons of documentation (online and books) available, tons of libraries, tons of person actually using it, lots of job opportunities, easy to learn, etc. I know some authors recommend learning lisp as a first language because there are not a lot of syntax and you can focus on the important problems. However, from my experience, my university colleague hated lisp and prolog, preferred C++ and really liked C# and Java. Lots of them were pretty beginners or bad programmers, but still, you can't start somewhere and be already an expert. So, hope it clarified what I mean by Java being friendly. And then, Clojure might be less friendly than java.. but still, in this mentality, might be more friendly than scheme .
- Tichy 16y agoIt 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 16y agoIt 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 16y agoI 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 16y agoRumor has it Scala works quite well on Android, but no dynamic language does yet.
- deleted 16y ago[deleted]
- masterponomo 16y agoThe 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.
- eliot_sykes 16y agohttp://clojure.org/rationale http://clojure.org/rationale
- Sapient 16y agoThe 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 16y agoMight be true of the rationale page, but http://clojure.org/state http://clojure.org/state is far more insightful than anything you will find in your average HN thread.
- masterponomo 16y agoI wouldn't have recommended the rationale if he had asked "Why do YOU care about Clojure." Not knowing anything about him other than his self-confessed lack of effort, I thought it best to point him to some source material, not tell him what suits ME (which he didn't ask anyway). Also, no fair someone else getting karma for posting the link to the rationale. I left it out in hopes that the lazy questioner would lift at least one finger in his quest for Clojure knowledge (no, not THAT finger).
- marcusbooster 16y agoI 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.
- ukdm 16y agoI'm looking forward to Land of Lisp being released to help me learn. Noticed it when that No Starch 50% off e-books offer was mentioned on HN the other day. Looks like a good started guide, plus making games always helps with motivation. Link: http://nostarch.com/lisp.htm http://nostarch.com/lisp.htm
- spooneybarger 16y agoTo others in a similar position: if you want to learn a lisp, I think racket ( aka plt scheme ) would be the easiest introduction.
- sivers 16y ago(now curious:) Why do you feel Racket is a good introduction to Lisp?
- spooneybarger 16y agoIt has been designed for teaching so there is a lot of material on their site geared towards learning. As part of that, it has a nice set of tools that make it easy to get started. There are a lot of books that teach intro to programming in scheme so there is plenty of offline material as well. The little schemer, SICP, How To Design Programs. See http://docs.racket-lang.org/ http://docs.racket-lang.org/. It also has an active mailing list that is quite noob friendly. EDIT: oh yes, and it is very a 'batteries included' environment. so you can worry about learning the language rather than getting your environment setup.
- ifesdjeen 16y agosame 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 16y agoThe language name is spelled as `Clojure' and not `Closure' (note the J).
- arete 16y agoLisp-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.
- KirinDave 16y agoIt'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 16y ago> 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 16y agoWhat are you talking about? Most of the startups discussed on this forum and/or funded by YC are using some subset of functional programming.
- francoisdevlin 16y agoHere's what Rich Hickey (our BDFL) has to say: For veteran lisp hackers http://clojure.blip.tv/file/1313398/ http://clojure.blip.tv/file/1313398/ For people just finding lisp http://blip.tv/file/982823 http://blip.tv/file/982823
- anon42389475 16y agoHow 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 16y agoAnother 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.
- yason 16y agoClojure 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 16y agoClojure 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 16y ago
- gtani 16y agoThere'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://searchyc.com/clojure?sort=by_points http://groovyguts.wordpress.com/2010/01/08/10-reasons-to-learn-clojure-or-any-other-lisp/ http://groovyguts.wordpress.com/2010/01/08/10-reasons-to-lea... http://stackoverflow.com/questions/2120946/what-kind-of-applications-are-appropriate-for-clojure http://stackoverflow.com/questions/2120946/what-kind-of-appl... --------------- http://news.ycombinator.com/item?id=1072822 http://news.ycombinator.com/item?id=1072822 http://news.ycombinator.com/item?id=1074136 http://news.ycombinator.com/item?id=1074136 http://news.ycombinator.com/item?id=1089139 http://news.ycombinator.com/item?id=1089139 http://news.ycombinator.com/item?id=1167820 http://news.ycombinator.com/item?id=1167820
- mbenjaminsmith 16y agoMy 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.
- smallegan 16y agoI am kind of feeling the same way about this. I find myself asking...If I dove head first into this what would be my ROI??
- spooneybarger 16y agoThis is one of the areas of programming language conversations that fascinates me. The area where differences in how people think bubble to the surface. "It's harder to understand at first, often un-intuitive" I always felt that way about VIM. With programming languages, 'the lisp way' has always been the best expression of how I usually think about solving problems. My brain naturally gravitates towards solution that involve macros, recursion etc. I can remember the first time I came across Common Lisp's condition system- my brain immediately went- 'this is so much more logical than exceptions in java/smalltalk etc'. I know people who find Haskell's pattern matching and guards completely foreign but are entirely at home with switch/case and if/else whereas to me they seem very close to one another.
- philwelch 16y ago"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 16y ago"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)
- WilliamLP 16y agoI'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."
- 16y ago
- rosejn 16y agoI'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.