Haskell

Ruby, Haskell and Euler

A while ago I stumbled across the Project Euler website, and before I knew it I found myself quite addicted to solving their small mathematical challenges. I quite naturally started solving in Ruby, since its what I do most of my programming in these days.

But lately I've been dabbling quite a bit with the pure function language Haskell, and after finishing some twenty challenges, I decided to start putting Haskell to the test. I started redoing each challenge in Haskell, and the result was quite interesting.

In general the Haskell solutions were just as readable and just as expressive (the line counts for the Ruby and Haskell solution was more or less identical). Haskell tends, of course, to really show its strengths in these kind of math-oriented problem areas, but I was still surprised to see a statically typed and compiled language so easily reach the same level of expressiveness as Ruby. And as a bonus, the Haskell solutions were an order of magnitude faster than the equivalent Ruby programs for the more demanding problems.

Naturally I am not about to jump from Ruby to Haskell for my daily web-programming tasks, but as I get more and more familiar with Haskell I am also getting more and more convinced, that some day knowing it might come in really handy.