Created
June 3, 2015 18:03
-
-
Save Tomren3000/9abf8285f10923ab3af3 to your computer and use it in GitHub Desktop.
printLines.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Char | |
navne :: [String] | |
navne = ["Morten", "Thomas", "Trine"] | |
buildString :: String -> [String] -> String | |
buildString a [x] = a ++ x ++ "\n" | |
buildString a xs = buildString (a ++ head xs ++ "\n") (tail xs) | |
buildString' :: String -> [String] -> String | |
buildString' a xs = if length xs == 1 | |
then a ++ head xs ++ "\n" | |
else buildString' (a ++ head xs ++ "\n") (tail xs) | |
folder :: [String] -> IO () | |
folder xs = putStr $ foldl (\result name -> result ++ name ++ "\n") "foo" xs | |
mapper = mapM_ putStrLn navne |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment