March 12th, 2005


from the "please refrain from saying things that are obviously false" department

Why Haskell?

2. Ease of understanding

Functional programs are often easier to understand. You should be able to understand the program without any previous knowledge of either Haskell or quicksort. The same certainly cannot be said of the C program. It takes quite a while to understand, and even when you do understand it, it is extremely easy to make a small slip and end up with an incorrect program. Here is a detailed explanation of the Haskell quicksort:

qsort [] = []
qsort (x:xs) = qsort elts_lt_x ++ [x] ++ qsort elts_greq_x
  elts_lt_x = [y | y <- xs, y < x]
  elts_greq_x = [y | y <- xs, y >= x]


Now, this is *understandable*. And when you make the jump that, apparently, Haskell has things that are very similar to standard set theory notation, it becomes significantly more obvious.

But it did take me a few minutes. And I'm still not entirely sure where x and xs are supposed to come from. And I know quicksort quite well.

So, yes. Given that it was quicksort, I was, eventually, able to figure out roughly how it worked, although I would still have some problems. But if I hadn't known how quicksort worked? Or if I hadn't known what it did? Yeah. Ain't gonna happen.

I do want to learn Haskell. But reading things like this really isn't reassuring.