6 ms·
Clojure, Scheme or Haskell ?
I am not trying to start a flame war, i am just interested in learning a new language after python and c. So which would you advice, clojure, scheme or haskell? I am only interested in developing web applications. thanks
- brehaut 17y agoI also came from Python (and c#/java, c, js) and have dabbled with Haskell and Clojure a bit, with a tiny bit in scheme. I personally think that learning both Haskell and Clojure concurrently has a lot of merit. Clojure is more pragmattic; while it encourages pure functional practices, it also accepts that doing IO and interacting with the ecosystem (including java) is necessary, so its straight forward. Haskell on the other hand is - IMO - a must learn for any programmer; It is chock full of brilliance, but its not so easy for someone unfamiliar with a type system as comprehensive to get going with. Many of the leasons you learn in Haskell will be applicable to clojure (and vice versa). Additionally, to me clojure feels like what i wanted python3000 to be. Its got a nice little ecosystem of web tools growing too. I found haskells web stuff to be a bit imposing. Summary: Learn clojure primarily, and augment it by working through haskell stuff like Real World Haskell.
- aitoehigie 17y agoi heard that for you to get the most out of clojure, you have to know java, is that true?
- brehaut 17y agoNo, you just need to be willing to learn some java APIs (honestly though, not that hard. mostly they are larger, more long-winded versions of things you are used to in python). In particular for web stuff you could probably exist within the clojure eco system. The clojure-contribs package is getting pretty comprehensive these days. Clojure's interop stuff makes calling java seem fairly native. Obviously you get stateful behavior and need to be careful, but thats no worse than python or c. Currently clojure's tools for creating classes is a little frustrating but thats being replaced with some very nice facilities in 1.1. I'd say the number one thing you'll need to do is get familiar with the javadoc. For the reference, i programmed java at uni (2001-2004) with Java 1.4. I havent written a java program since then, but i havent found it any hinderance at all in my experiments with clojure.
- dkersten 17y agoIf you're looking for a practical language with which you can quickly build real-world applications, I would vote for Clojure, simply because it has a wealth of libraries readily available through Java. Having said that, I haven't got a lot of experience with Haskell and certainly not with its libraries, so I don't really know how it compares, besides the fact that Java has a huge amount of libraries for just about anything you could want. This also means that you can write web apps in Clojure and deploy them on one of the many Java-based web platforms - that is, its reasonably easy to get your Clojure (or rather, JVM) based web app out there. If you do decide to go for Clojure, the defacto web framework is Compojure, which is a very simple, but powerful and flexible, framework. It has some nifty features, such as allowing you to write HTML using s-expressions instead of XML tags resulting in much simpler and shorter HTML. Clojure also has a library which helps you to write Javascript in an integrated Clojure-esque s-expression based way called Scriptjure. All in all, Clojure + Compojure + Scriptjure provides a consistent and integrated framework for developing rich web apps. You can be up and running in Jetty within moments and with a few minutes of preparation, you can compile your app as a .war file ready for deployment in something like Apache Tomcat. The only thing that takes some Java API knowledge is interfacing with a database, though afaik theres some Clojure wrappers for that too. If you don't mind looking through some Javadoc and want some NoSQL goodness, I'd recommend grabbing the MongoDB Java Driver. It happened to be the first Java API I tried to interface with in Clojure and I was pleasantly surprised at how hassle free and easy it was to get it to work. Whatever you choose, good luck! It should be fun to get into functional programming after working with C and Python :-)
- brehaut 17y agoThis also means that you can write web apps in Clojure and deploy them on one of the many Java-based web platforms - that is, its reasonably easy to get your Clojure (or rather, JVM) based web app out there. Including App Engine (and thus you can also write bots for Wave) http://elhumidor.blogspot.com/2009/04/clojure-on-google-appengine.html http://elhumidor.blogspot.com/2009/04/clojure-on-google-appe...
- tumult 17y agoYou should learn Scheme, and then Haskell or an ML language (OCaml would be my choice.) Clojure is a "subset" of Scheme/Lisp, so if you learn Scheme or Lisp (as in Common Lisp), you basically know Clojure, plus some extra stuff that Clojure can't do because it lacks proper tail calls.
- grinnbearit 17y agoI personally find scheme to be the simplest Lisp to learn (after working with Common Lisp, Clojure and Scheme). If you do want to learn scheme, I found the MIT lectures http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-001Spring-2005/VideoLectures/index.htm http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Compute... brilliant and the little schemer http://www.amazon.com/Little-Schemer-Daniel-P-Friedman/dp/0262560992 http://www.amazon.com/Little-Schemer-Daniel-P-Friedman/dp/02... a lot of fun as well.
- mark_l_watson 17y agoYou might want to experiment for an hour or so with DrScheme/MzScheme: lots of good libraries for web app development -- same comment applies to Chicken Scheme. My favorite Scheme is Gambit-C which has fewer libraries but if you install from source, then look in the examples directory for a simple HTTP server example. That said, DrScheme would be a fast way to evaluate Scheme for your purposes.
- AndrewW 17y agoI came to Scheme from C and Java and have looked briefly at Clojure. Clojure is a great effort and makes interfacing with Java simple but unless you are forced to use the JVM, I would recommend a regular Scheme instead. Clojure doesn't support continuations and tail call optimisation which are key features of Scheme and contribute significantly to its brilliance. Gambit is a very practical implementation that is fast and offers relatively easy interfacing to C. But, most serious effort in functional programming is done in Haskell or OCaml so thats where the libraries and jobs are. Of the two, I think Haskell is probably bigger and is the better language with more features. My recommendation would be to learn Scheme until you understand the basics, continuations and macros and then move on to Haskell which will be a lot easier having come from Scheme.