blob: 30b4ab42f04960a0f326d9bec4a1c17211891373 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
-- Quick sort for Haskell.
module Main where
qs :: [Int] -> [Int]
qs [] = []
qs (a:as) = qs [x | x <- as, x <= a] ++ [a] ++ qs [x | x <- as, x > a]
main =
appendChan stdout "Enter a list of integers separated by \",\"\n" abort $
readChan stdin abort $ \ input ->
appendChan stdout (show (qs (read ("[" ++ (head (lines input)) ++ "]"))))
abort done
|