fork download
  1. import Control.Arrow
  2. import Control.Monad
  3. import Data.List (group)
  4.  
  5. main :: IO ()
  6. main = mapM_ putStrLn . take 11 . iterate f $ "1"
  7.  
  8. f :: String -> String
  9. f = group >=> length &&& head >>> show *** (:[]) >>> uncurry (++)
  10.  
Success #stdin #stdout 0s 6220KB
stdin
Standard input is empty
stdout
1
11
21
1211
111221
312211
13112221
1113213211
31131211131221
13211311123113112211
11131221133112132113212221