93 points · by fogus · 16y ago · 40 comments
http://mmcgrana.github.com/2010/03/clojure-web-development-r...
Just install leiningen, whip out your favorite text editor, and you don't have to worry about downloading/installing clojure, libraries and deps.
http://www.amazon.com/Practical-Clojure-Experts-Voice-Source...
and Manning has 2 MEAP books in the pipeline
I don't find these to be really good advantages.. First, "functional" isn't an advantage.. I mean, the advantage of functional code might be easier maintenance, concise code, easier to concurrence etc.. but "functional" isn't an advantage. It's like saying C++ is better than ruby because it is imperative or OO.. "Why is imperative or OO better?", that's the interesting part.
In my opinion, the advantage of clojure by comparing it with Ruby are:
- You get the best of Java (lots of library, OO) - You get the best of Lisp (macro, high level function)
Those are all good reasons why functional programming is an advantage. I guess you object to my grouping of all these under the "functional" umbrella term.
> In my opinion, the advantage of clojure by comparing it with Ruby are: - You get the best of Java (lots of library, OO)
I mention this as well, but that's not really an advantage over Ruby. JRuby gives you access to all the Java libraries you want.
Clojure Dude (talking to ruby dude): Hey, you should try clojure.
Ruby Dude: What is clojure ?
Clojure Dude: Oh, clojure is a lisp/functional language. You should really give it a try.
Ruby Dude: Why?
Clojure Dude: Its main advantage is that it's functional.
Ruby Dude: Wow, you convince me. I'm switching!
http://www.infoq.com/interviews/armstrong-peyton-jones-erlan...
But it turned out to be very hard to turn that into actual wall clock speedups on processes, leaving aside all issues of robustness or that kind of stuff, because if you do that style of concurrency you get lots of very tiny fine-grained processes and you get no locality and you get very difficult scheduling problems. The overheads overwhelm the benefits, in short.
It may be true that FP does make concurrency easier, but I don't think this has been demonstrated to be generally true yet and it's certainly not as simple as just eliminating side effects from your code.
What functional programming does mean right now is that it's much easier to chop your program up into reasonable-sized chunks: big enough that it's worth the overhead, small enough that you can distribute as widely as possible.
In other words, if you think of a functional program as a tree and then expect to run each leaf in its own thread, the overhead will vastly outweigh the benefits. But the functional semantics also allow you to run each of the dozen main branches in separate threads with little effort.
I do this in Clojure all the time.
Perhaps not generally true, but I think MapReduce and LINQ are two prominent examples of how a "functional programming-like" model lends itself to easy parallelization and distribution.
To your second point, I made no claims that C and C++ are not used to solve performance intensive problems. I'm sure C and C++ (or Assembly, for that matter) can be applied to solve any number of problems, if that's one's calling.
With functional languages and "dumb" data you don't have to guess about what your data can do. You just do what you want with it.