Skip to content

Instantly share code, notes, and snippets.

@MichaelBlume
Last active December 18, 2015 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelBlume/5847895 to your computer and use it in GitHub Desktop.
Save MichaelBlume/5847895 to your computer and use it in GitHub Desktop.
prints the library of babel
import Control.Monad
chars :: [Char]
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ,.'\"-;:?!()"
incrementS :: [[Char]] -> [[Char]]
incrementS [] = [chars]
incrementS ([_] : r) = chars : (incrementS r)
incrementS ((c:cs) : r) = cs : r
allBabel = map (map head) $ iterate incrementS []
main :: IO ()
main = forM allBabel putStrLn >> return ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment