On Thursday, 20 November 2014 at 22:47:27 UTC, Walter Bright wrote:
On 11/20/2014 1:55 PM, deadalnix wrote:
All of this is beautiful until you try to implement a quicksort
in, haskell.

[…]

Monads!

I think Deadalnix meant that you cannot do in-place quicksort easily in Haskell. Non-mutating quicksort is easy, no need for monads:

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

https://www.haskell.org/haskellwiki/Introduction#Quicksort_in_Haskell

Reply via email to