Skip to content

Instantly share code, notes, and snippets.

@favonia
Last active August 29, 2015 14:13
Show Gist options
  • Save favonia/5ad545427e43c4dfc386 to your computer and use it in GitHub Desktop.
Save favonia/5ad545427e43c4dfc386 to your computer and use it in GitHub Desktop.
Recursive warning
-- 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