Skip to content

Instantly share code, notes, and snippets.

@adpoe

adpoe/quicksort.hs

Created Jun 16, 2016
Embed
What would you like to do?
Very simple Quicksort Implementation from "Learn You a Haskell For Great Good!"
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) =
let smallerSorted = quicksort [a | a <- xs, a <= x]
biggerSorted = quicksort [a | a <- xs, a > x]
in smallerSorted ++ [x] ++ biggerSorted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment