Last active
August 29, 2015 14:13
-
-
Save favonia/5ad545427e43c4dfc386 to your computer and use it in GitHub Desktop.
Recursive warning
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
-- released under CC0 by favonia | |
import System.Environment | |
quotes :: [String -> String] | |
quotes = map q $ cycle [("「", "」"), ("『", "』")] | |
where q (l,r) str = l ++ str ++ r | |
warn :: (String -> String) -> String -> String | |
warn q str = concat ["分享", q str, "難判定有無違法,盡量不要分享", q str, ",以免觸法。"] | |
seed :: String | |
seed = "不能宣傳 2/14 罷免蔡正元" | |
gen :: Int -> String | |
gen n = foldr warn seed (take n quotes) | |
main = do | |
[n] <- getArgs | |
putStrLn $ gen (read n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment