Skip to content

Comment on Why I'm a Programmerparent

Comments

I'm sorry, could you be more specific?

I started learning Haskell for the same reason that Peaker described. From what I understand so far, Haskell is a very high level language which lets you do more with less.

One of the examples that come often is quicksort which you can write in like 3 lines:

quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater) where lesser = filter (< p) xs greater = filter (>= p) xs

But the thing is you still have to understand a lot of stuff before being able to use it correctly. I think one of the most difficult (and interesting) topic would be monads, there are tons of tutorials online if you're interested on reading on it.

It's not a quicksort. It's a quasi-quicksort, which is actually not quick due to memory allocations.

Here's how quicksort looks like in haskell:

    import Data.Vector.Generic
    import qualified Data.Vector.Generic.Mutable as M 

    iqsort :: (Vector v a, Ord a) => v a -> v a
    iqsort = modify go where
             go xs  | len < 2   = return ()
                    | otherwise = do
                        p <- xs `M.read` (len `div` 2)
                        m <- M.unstablePartition (< p) xs
                        go $ M.slice 0     m         xs
                        go $ M.slice (m+1) (len-m-1) xs
                    where len = M.length xs
Or something like this (u-u-ugly) http://www.haskell.org/haskellwiki/Introduction/Direct_Trans...

At this point it's less for more.

I don't understand why they chose quicksort to show off.

The post I replied to said:

> I am programmer because I am naturally curious and because I love creative problem solving.

Which is still an excellent reason to be a programmer.

> What honestly pisses me off, is that these days programming is way more boring than what it used to be.

Completely disagreed! He's just focusing on the wrong things.

> The paradigm has shifted from low-level to high-level and as such we've lost steady, stable interfaces and systems and moved to very rapidly changing playground

I was trying to say that moving from low to high level does not mean losing stable interfaces, and it doesn't mean we need to have a "rapidly changing playground".

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.