Zorba the Hutt (zorbathut) wrote,
Zorba the Hutt
zorbathut

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
 where
  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.
Subscribe

  • (no subject)

    For a while I've been posting entries from my dev journal, Mandible Games, in here as well. I made some setting changes to my blog and that ended up…

  • Roguelikes: The Misnamed Genre

    Recently, I’ve been playing a game called Dungeon Crawl: Stone Soup. You should play it. It’s good. DCSS is a game about searching a…

  • The Origin of a New Game

    I’ve got another megapost percolating, but I saw something from Warren Ellis and had to quote it: Sometimes it works like this. You can’t…

  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 8 comments