From 0a48ed023ea65d75851ba2a4151100602695a2fd Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 22 Oct 2015 14:05:21 +1100 Subject: Cleaning up source a bit --- sort/quick.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 sort/quick.hs (limited to 'sort/quick.hs') diff --git a/sort/quick.hs b/sort/quick.hs new file mode 100644 index 0000000..44efd81 --- /dev/null +++ b/sort/quick.hs @@ -0,0 +1,15 @@ +module Quick ( + quickSort + ) where + + + +quickSort :: Ord a => [a] -> [a] +quickSort [] = [] +quickSort (x:xs) = + let less = [ a | a <- xs, a < x ] + equal = [ b | b <- (x:xs), b == x ] + greater = [ c | c <- xs, c > x ] + in quickSort less ++ equal ++ quickSort greater + + -- cgit