Skip to content

Instantly share code, notes, and snippets.

@gregmuellegger
Created July 18, 2012 20:55
Show Gist options
  • Save gregmuellegger/3138834 to your computer and use it in GitHub Desktop.
Save gregmuellegger/3138834 to your computer and use it in GitHub Desktop.
Wopp!
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