LoginSignup
5
5

More than 5 years have passed since last update.

「進捗・どう・です・か」をHaskellで書いてみた

Posted at

元ネタはこちらです
「進捗・どう・です・か」をランダムに表示し「進捗どうですか」が完成したら煽ってくるプログラム

最高です!センス抜群です!
元ネタの元ネタは下ネタでしたがこれなら職場でも堂々と使えます!!

import Data.List
import System.Random

inflame :: String -> IO String
inflame s = do
    s' <- (s ++) . (["進捗", "どう", "です", "か"] !!) <$> randomRIO (0, 3)
    if isSuffixOf "進捗どうですか" s'
        then return (s' ++ "???")
        else inflame s'

main :: IO ()
main = do
    s <- inflame ""
    putStrLn s
    putStrLn $ show (length s) ++ "文字で煽られました。"
5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5