Jorge Tavares weblog

Posts Tagged ‘Haskell

Starting with Haskell

with 4 comments

haskell-logo-nobg

Around ten years ago I learned to program in Lisp, Common Lisp to be more precise. And since then I believe I never actually learned a new language that impressed me, and excited me, so much as was the experience of learning Lisp.

Well, yesterday I started to learn more seriously Haskell. For quite some time my interest in the language has been increasing. From several blogs posts, comments and discussions on the web, it is almost impossible not to be curious. Yes, I’ve heard of Haskell for a very long time but it seems the buzz on my ears raised a lot recently. And so, I’ve decided to take a look. In the worst case scenario, it would a be just a few hours of playing around with a new language.

Up until now, I didn’t do much. Installed the Haskell platform, haskell-mode in Emacs (although I ended up using Vim too to code) and searched for some basic tutorial. My starting choice is “Learn You a Haskell for Great Good!”. It looks nice. Seems suitable for a beginner and starts in a simple way. The first real chapter is the second one, which I just did yesterday. I was very impressed with it. And perhaps more important, very happy with the experience. To be honest, I don’t remember a similar feeling with other languages… except Lisp! Although this “Starting Out” chapter introduces just some very basic Haskell stuff, it is already a lot to feel the language and the potential of it. The last example was very cool. Suppose you want to find the right triangle that has integers equal or smaller than 10 for all sides and has a perimeter of 24. With tuples, list comprehensions it’s just a matter of writing:

[(a,b,c) | c <- [1..10], b <- [1..c], a <- [1..b], a^2 + b^2 == c^2, a + b + c == 24]

Simple, concise and very neat! I still didn’t do anything proper with Haskell. I am just in the very very very beginning but it looks promising. I could be wrong about it sure, but the feeling is nice.

Also, recently, I started to take a look at Clojure, another Lisp. I had some hopes that would be a very nice experience. Unfortunately, it was not. For some reason, I am unable to appreciate the “beauty” of a JVM language. But let’s see how Haskell will fare when I start to try it with the kind of stuff I’m interested in.

Written by Jorge Tavares

October 16, 2009 at 14:26

Posted in Programming

Tagged with