diff --git a/1_hello_world/hello_world.hs b/1_hello_world/hello_world.hs new file mode 100644 index 0000000..6a9442b --- /dev/null +++ b/1_hello_world/hello_world.hs @@ -0,0 +1,7 @@ +main = do + --This line prints the String "Hello, World." + putStr "Hello, World." + --Define a variable within this do-block. + let myVar = "Hello World" + --Print the contents of the variable on the screen. + putStr myVar diff --git a/9_quick_sort/quick_sort.hs b/9_quick_sort/quick_sort.hs new file mode 100644 index 0000000..ce2c1c8 --- /dev/null +++ b/9_quick_sort/quick_sort.hs @@ -0,0 +1,13 @@ +quicksort :: [Int] -> [Int] +quicksort [] = [] +quicksort (x:xs) = (quicksort leftSide) ++ [x] ++ (quicksort rightSide) + where leftSide = filter (=x) xs + +-- +main = do + putStrLn "Awaiting Integer list like: [1,3,6,42,...]" + myArray <- getLine + let toSort = read myArray :: [Int] + putStrLn "The sorted array is:" + putStrLn $ show $ quicksort toSort