Hacker News new | past | comments | ask | show | jobs | submit login

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.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: