TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Clojure: All grown up

240 点作者 djacobs大约 12 年前

23 条评论

tikhonj大约 12 年前
Clojure is nice, but the idea that it is somehow built for the real world where Haskell isn't is just patent nonsense that I wish people wouldn't repeat. You do not need to understand complex math to actually use Haskell! All the important ideas can be understood and used in Haskell terms alone--you can think of them just like the ideas and jargon introduced in other languages. Except more general, more elegant and more consistent because they have a unifying underlying theory which the people who designed them in the first place <i>do</i> understand.<p>The biggest conceptual shift is to thinking functionally rather than imperatively, so it's going to be similar in both languages. The difference is that Haskell is more thorough, but the fundamental ideas are very similar.<p>Haskell, of course, has many of its own advantages which are mostly detailed elsewhere. I'm merely going to give you my highest-level take-away from trying Clojure: Haskell has much better facilities for abstraction. Haskell allows you to use types and data representation specific to your donation while still allowing you to take advantage of some very generic libraries. And the custom types are not actually complex, unlike what Clojure leads you to believe with its preference to using the basic built-in types: you construct your types from basically three fundamental operations: combining multiple values into one (like a tuple or struct), giving a choice of values (like a variant or disjoint/tagged union) or creating functions. That's all there is to them!<p>Basically, don't be afraid of Haskell, whatever the common wisdom is. As usual with these sorts of things, it's much more common than wise.
评论 #5364283 未加载
评论 #5364104 未加载
评论 #5365042 未加载
评论 #5364063 未加载
评论 #5364438 未加载
评论 #5364480 未加载
评论 #5364449 未加载
评论 #5365333 未加载
评论 #5364408 未加载
评论 #5366666 未加载
评论 #5364114 未加载
评论 #5365194 未加载
评论 #5364427 未加载
评论 #5367199 未加载
lkrubner大约 12 年前
This is very true:<p>"Leiningen and Cake, joined forces to become an all-powerful build tool. Then Leiningen reached version 2. (And let me tell you, Leiningen 2 alone makes Clojure worth using.)"<p>Other build tools, and package managers, such as "bundler" in the Ruby world, seem pretty weak compared to Leiningen. This is a very powerful tool.<p>The tooling and the eco-system are reaching a very powerful level. For now, I use Emacs as my editor, but I am waiting for LightTable ( <a href="http://www.chris-granger.com/2012/11/05/meet-the-new-light-table/" rel="nofollow">http://www.chris-granger.com/2012/11/05/meet-the-new-light-t...</a> ) to get just a little further, and then I intend to switch to it.<p>This whole article is good, but this is the part that gets to the heart of the matter:<p>"Rubyists know that their language effectively got rid of for loops. In the same way, Clojure gets rid of imperative iteration in favor of declaration. Your thoughts shift away from place-oriented constructs like memory and gravitate to data structures and functions like map, reduce and filter. Your “class hierarchy” turns out to be a type system that happens to also lock away well-meaning functions into dark dungeons (more on that in another article), and getting away from that is freeing."<p>That might be the best summary of the strengths of Clojure: it helps you think about data structures and transformation, rather than thinking about the ceremonial and imperative code that your language needs to hear.
DigitalJack大约 12 年前
I'm a big fan of Clojure, but I don't think I'd ever write an article like this. I guess I must not be an evangelist at heart...I will tell people that I like something, but I never tell them that they <i>must</i> use it.<p>You know yourself far better than I know you, and so why would I presume to tell you how to live your life?<p>Functional programming is sometimes great. Most forms of programming are sometimes great. But I don't think there is one form that is great all the time. Maybe there is, and maybe if I come across it I'll be smart enough to recognize it... but in the mean time, I'll just try to use what makes sense to me.<p>And sometimes, functional programming just doesn't make sense to me. I still can't quite get my head around monads. They have just one or two too many levels of abstraction for me to hold in my head. I think I'm almost there, and was trying very hard to grasp them, but then in one of the videos I was watching, the guy said this: "Monads are a solution to a problem you will <i>never</i> have." He said it in jest, partly because the language at hand was Javascript, but it really stuck out to me.<p>Clojure has what I would call "sensible" state containment via STM. And sometimes just plain storing some state is the easiest and most straight forward way to go.<p>I love working in Clojure because it makes it so easy to break down problems into bite sized functions. That, and the concision of the syntax suits me. I'm trying to accomplish the same thing in Java by having some classes that I treat as a namespace and load them up with static functions in that namespace. I'm sure a lot of people would spontaneously barf on their screen if they saw my code though.
评论 #5364106 未加载
评论 #5365205 未加载
评论 #5363687 未加载
weareconvo大约 12 年前
I tried switching to Clojure, and while I love the purity, simplicity, and logic of it, two things always bothered me:<p>1) Immutable data structures are always going to be slower than their mutable cousins.<p>2) "Clojure code is beautiful" should be changed to "Your OWN Clojure code is beautiful". When I finished writing a compact piece of logic or data transformation, I was often struck with the beauty of it. When I tried to read someone ELSE's Clojure code, however, I couldn't even begin to make sense of it.<p>I am ever open to being proved wrong, however. Any Clojure programmers reading this, please reply with some code that is readable, elegant, and performant, to provide a counterpoint to my pessimism.
评论 #5363829 未加载
评论 #5363877 未加载
评论 #5363667 未加载
评论 #5364405 未加载
评论 #5363788 未加载
评论 #5363731 未加载
评论 #5364441 未加载
评论 #5365206 未加载
评论 #5363937 未加载
pbiggar大约 12 年前
Totally agree. We built a PaaS entirely in Clojure (<a href="https://circleci.com" rel="nofollow">https://circleci.com</a>) and its absolutely a grown-up language. I was unsure when we started (my cofounder has been using Clojure since 2008 and was adamant that this was a good idea), but Clojure makes it very easy to write big hardcore systems. Definitely one of our competitive advantages.
评论 #5363986 未加载
bascule大约 12 年前
I also started with Ruby (well, after a number of other languages) and used Clojure for a time, and I just can't sympathize with this:<p>"And—if you like avoiding unnecessary frustration and boilerplate—it will make you happy."<p>Didn't get this feeling. I like avoiding unnecessary frustration and boilerplate! A great way to avoid boilerplate is to hide it behind macros, however that's not necessarily a great way to avoid frustration.<p>Know what's really awesome? When a macro injects a recur point, and suddenly you're not recuring to where you think you are, you're recuring to a point within the macro somewhere. The only way to figure this out is to go dig through the source of the macro.<p>Sorry Clojure fans, what can I say? This did not make me happy. I am told that if Clojure did not make me happy, that's my fault, because I didn't study Clojure hard enough or something to get to the point where I should feel the Zen of Lisp flowing through my brain. Clearly this must be the blub paradox at work.<p>Maybe it's my fault, or maybe Clojure isn't the greatest language in the world for everyone.
评论 #5364221 未加载
评论 #5365352 未加载
alexatkeplar大约 12 年前
I wrote an event collector for SnowPlow in Clojure (<a href="https://github.com/snowplow/snowplow/tree/master/2-collectors/clojure-collector" rel="nofollow">https://github.com/snowplow/snowplow/tree/master/2-collector...</a>), and really enjoyed the experience. Leiningen is excellent, far better than any other build tool I've used, and Ring and Compojure were both great.<p>My only grumble with Clojure is that nobody seems to document the types that their functions take and return. It's a PITA having to read through a whole chain of functions just to figure out the types which are passing through it.
jboggan大约 12 年前
We use a lot of Clojure here at Factual: <a href="http://www.factual.com/jobs/clojure" rel="nofollow">http://www.factual.com/jobs/clojure</a><p>I'm still in the process of learning from the Clojure gurus around here but I see that it has a lot to recommend it. I can already see increases in the clarity of my code when I write filters and functions for our data pipeline. The next step is to learn Cascalog.<p>We're fielding a sizable contingent to the Clojure West conference this weekend (which we're also sponsoring) so come say hi if you're in out in Portland!
juskrey大约 12 年前
As for me, I did not even know the word "homoiconic", until yesterday, when I bought a book on Clojure, after reading the author.<p>What I do know, is that I was in love with Assembler since my first steps in programming and hacking. While everyone in my surroundings were using pascal and basic that days, inlining asm only for occasional IO work, I used to scaffold tremendous routines and structures in a matter of days, using base asm and macro. While my friends, looking at my sources, were only able to say "what the ...ck is this, that is insanly sick, how do you understand all this?", asm was so natural and fluent to me.<p>Then dark times of C and C++, Java, C# etc. followed (BTW, I hate purified OOP deep inside, it always seemed to me so unhuman), and several years ago my roads crossed with LUA, and I instantly loved it. Pity, I had no chances to use it much, but I remember that feeling, when code and data magically interlace and create beautiful structures.<p>Now I am looking at Clojure and recalling my Asm youth, and these awesome days with LUA. But this time it has all the power of interop with major libs and services. I am giving it a try.
kreek大约 12 年前
Any recommendations for a web framework in clojure? I played around with Noir for a while but it seems like that project is abandoned now? What's the Sinatra/Flash of Clojure?
评论 #5364362 未加载
评论 #5364165 未加载
dschiptsov大约 12 年前
Sounds good when you know nothing but Java and never heard of CL - knew nothing about, say (disassemble #'foo) or what is FFI etc.<p>This is also very telling - <i>lets you deploy your Clojure Web app to a JBoss server and take advantage of JBoss’s scalability without any XML configuration. You get a mature enterprise-ready Java server without the pain of Java or of configuration.</i><p>I wonder how many orders of magnitude difference in "scalability" we would see with a simple nginx -&#62; fastcgi -&#62; sbcl setup.)<p>Memory usage under long periods of time with pending storage/back-end calls is also interesting topic - how JVM blows up just after few hours in "production".)
评论 #5364617 未加载
评论 #5365198 未加载
评论 #5363899 未加载
robertfw大约 12 年前
Can anyone speak to the experience of debugging Clojure, especially without having JVM experience? The one thing that has me concerned is the depth of crash dumps and the amount of JVM knowledge required to interpret them.
评论 #5364661 未加载
评论 #5364713 未加载
virtualwhys大约 12 年前
Luminus and LightTable (wow, that in-editor javascript demo) look pretty awesome.<p>Coming from Scala/Play my initial resistance to jumping the fence are: 1) lack of compile time type safety 2) odd, for me, language syntax 3) no ScalaQuery/Slick functional SQL wrapper equivalent<p>How is Scala-Clojure interop? Would be interesting to jar up existing Slick-based model layer and invoke within Clojure stack ;-)<p>Not having yet taken the plunge, based on the LightTable demo Clojure development seems pretty rapid fire (read: no waiting for compiler to catch up).
评论 #5367228 未加载
评论 #5366527 未加载
dogweather大约 12 年前
This is a very intriguiging post it constantly makes reference to Rails and Django. But it stops there at the abstract.<p>Can someone point to an A/B comparison ... a simple Rails/Django app and the Clojure equivalent?<p>"Just show me the code."
Freaky大约 12 年前
Weird font rendering on this site - the glyphs are very distractingly blobby. Increasing or decreasing the zoom level helps a lot if anyone's finding it similarly unreadable.
bitwize大约 12 年前
No thanks, I'll stick to Gambit.<p>Fast, RnRS/IEEE Scheme compliant, has a great runtime layer and FFI, can integrate with anything written in C.
caycep大约 12 年前
I'd like to play around with this (as well as actually read SICP). However, does the fact that Apple keep blacklisting the Oracle JVM get in the way? Would be nice to have Clojure bundle its own JVM rather than have a dependency, unless I am totally doing something wrong in setting it up (homebrew).
评论 #5369067 未加载
razielek大约 12 年前
Anybody would recommend Eclipse instead of Emacs? Or maybe other IDE? I don't want to learn Emacs and its keybindings, but if I have to, better tell me now. :)
评论 #5367116 未加载
评论 #5366053 未加载
评论 #5369303 未加载
评论 #5366551 未加载
berlinbrown大约 12 年前
Clojure has been grown up, it hasn't change that much since several years ago, especially on the surface.
gtani大约 12 年前
This guy reminds me of Uncle Bob
MrMan大约 12 年前
there is a gulf between clever and smart. it may be clever to use Haskell, but is not smart to hijack a clojure thread to argue about it, again. if I had the power to downvote I would be using it here.
michaelochurch大约 12 年前
Clojure's great. While I like static typing in general, I see a better chance of long-term success in Clojure over Scala. With Scala, there's nothing wrong with the language, but the amount of Java-in-Scala code I've seen has convinced me that there's unintended cultural risk-- at least in the enterprise, where software has been done wrong for decades-- while Clojure forces people to be exposed to new ways of doing things.
评论 #5363947 未加载
评论 #5364372 未加载
keyle大约 12 年前
Oh my, the flame wars. Search for instances of the word "haskell" and "clojure" to see what I mean.