Created
July 18, 2012 20:55
-
-
Save gregmuellegger/3138834 to your computer and use it in GitHub Desktop.
Wopp!
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
wopp = map sayIt [1..] | |
where woppln n | (mod n 7 == 0) = True | |
| ('7' `elem` show n) = True | |
| otherwise = False | |
sayIt n = (if woppln n then "wopp" else show n, if direction n > 0 then "right" else "left") | |
direction 1 = 1 | |
direction n | woppln n = (-1) * direction (n-1) | |
| otherwise = direction (n-1) | |
main = do | |
printWopp $ take 100 wopp | |
printWopp :: [(String, String)] -> IO () | |
printWopp [] = do return () | |
printWopp (x:xs) = do | |
putStrLn $ fst x ++ ", next person is " ++ snd x | |
printWopp xs | |
return () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment