Last active
May 24, 2016 09:45
-
-
Save stripe-q/3575c5c264b54a0149aa5aa714bb90bb to your computer and use it in GitHub Desktop.
myAction.hs -> n 을 입력받고, n 줄만큼의 문자열을 입력받아 이를 공백으로 연결하여 출력한다.
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
main = do | |
n <- readLn :: IO Int | |
a <- sequence . replicate n $ getLine | |
putStrLn . unwords $ a | |
-- do 가 아닌 모나드 연산자를 이용한 결합. | |
main' = (readLn :: IO Int) >>= (\n -> (sequence . replicate n $ getLine) >>= (\a -> puStrLn . unwords $ a)) |
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
-- sequnce . replicate n = replicateM n | |
import Control.Monad | |
main = (readLn :: IO Int) >>= (\n -> replicateM n getLine >>= (\a -> putStrLn $ unwords a)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment