qsort [] = []
qsort (p:xs) =
let (lt, gt) = partition' ((>) p) xs
in qsort lt ++ [p] ++ qsort gt
partition' _ [] = ([], [])
partition' f (x:xs) =
let (accepted, rejected) = partition' f xs
in if f x then (x:accepted, rejected)
else (accepted, x:rejected)
main = do
print $ qsort [3,1,2]
print $ partition' odd [1,2,3,4,5]
To embed this project on your website, copy the following code and paste it into your website's HTML: