Skip to content

Instantly share code, notes, and snippets.

@Juddling
Created December 30, 2016 18:14
Show Gist options
  • Select an option

  • Save Juddling/035b7730e273fdc305ca1259a60e4e5e to your computer and use it in GitHub Desktop.

Select an option

Save Juddling/035b7730e273fdc305ca1259a60e4e5e to your computer and use it in GitHub Desktop.
quicksort [] = []
quicksort (pivot:tail) = sorted_less ++ [pivot] ++ sorted_greater
where
sorted_less = quicksort [x | x <- tail, x <= pivot]
sorted_greater = quicksort [x | x <- tail, x > pivot]
main = do
putStrLn "quicksort:"
print $ quicksort [10,9..0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment