Last active
December 29, 2015 10:49
Revisions
-
pasberth revised this gist
Nov 26, 2013 . 1 changed file with 15 additions and 12 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,20 @@ --ちんちんっぽいことするやつ import System.Random chimpo :: String -> IO String randomString :: String -> IO String chimpo c = do s <- randomString c if take 4 c == "ABCDE" then return $ c ++ ("なんか終わりました" ++ (show (length c ))) else chimpo s randomString s = getStdRandom (randomR ((0, 4)::(Int,Int))) >>= \r -> case r of 0 -> return ("A" ++ s) 1 -> return ("B" ++ s) 2 -> return ("C" ++ s) 3 -> return ("D" ++ s) 4 -> return ("E" ++ s) main = do x1 <- randomString "" x2 <- chimpo x1 putStrLn x2 -
haru2036 created this gist
Nov 26, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ --ちんちんっぽいことするやつ import System.Random chimpo :: String -> String randomString :: String -> String chimpo c = if take 4 c == "ABCDE" then c ++ ("なんか終わりました" ++ (show (length c ))) else chimpo (randomString c) randomString s = getStdRandom(randomR(0,4)) >>= \r -> case r of 0 -> ("A" ++ s) 1 -> ("B" ++ s) 2 -> ("C" ++ s) 3 -> ("D" ++ s) 4 -> ("E" ++ s) main = putStrLn (chimpo (randomString ""))