Skip to content

Instantly share code, notes, and snippets.

@myme
Created November 5, 2012 09:01
Show Gist options
  • Save myme/4016129 to your computer and use it in GitHub Desktop.
Save myme/4016129 to your computer and use it in GitHub Desktop.
Flippety
djent :: ~/try-bin/hs » ./toFive.hs
222
2 2
2
22
22222
--- le mirror ---
55555
55
5
5 5
555
#!/usr/bin/env runghc
two = unlines
[ " 222 "
, "2 2"
, " 2 "
, " 22 "
, "22222"
]
main = mapM_ putStrLn [ two, "--- le mirror ---\n", toFive two ]
where toFive = map subNum . unlines . reverse . lines
subNum x = if x `elem` ['0' .. '9'] then '5' else x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment