Created
April 5, 2017 06:38
-
-
Save krdlab/986dd27acfa9273ffe60a50207c52617 to your computer and use it in GitHub Desktop.
職場の同僚に教えてもらったネタ
This file contains hidden or 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 System.Random (randomRIO) | |
zndk :: [String] | |
zndk = ["ズン", "ドコ"] | |
kiyoshi :: IO () | |
kiyoshi = go 0 | |
where | |
go c = rand zndk >>= \v -> putStr v >> go' c v | |
go' c "ズン" = go (c + 1) | |
go' c "ドコ" | |
| c < 4 = go 0 | |
| otherwise = putStrLn "きよし" | |
rand :: [a] -> IO a | |
rand xs = (!!) xs <$> randomRIO (0, length xs - 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment