[ create a new paste ] login | about

Link: http://codepad.org/C9LValE7    [ raw code | output | fork ]

Haskell, pasted on Oct 14:
1
2
3
4
5
6
7
8
9
10
import Data.List

mm = "1  2  3  4\n5  6  7  8\n9 10 11 12\n13 14 15 16\n17 18 19 20" -- input


ex [] = []
ex m  = (head m) ++ ex (transpose . map reverse . tail $ m)                  

main = putStrLn . concat . intersperse " " $ ex (mme mm)
    where mme m = map reverse $ map words $ lines m


Output:
1
4 3 2 1 5 9 13 17 18 19 20 16 12 8 7 6 10 14 15 11


Create a new paste based on this one


Comments: