fork(3) download
  1. import Data.List
  2.  
  3. s[]=[];s(h:t)=h++(s$reverse$transpose t)
  4.  
  5. main =
  6. print $ map s [
  7. [],
  8. [[1]],
  9. [[1, 2], [4, 3]],
  10. [[1, 2, 3], [8, 9, 4], [7, 6, 5]],
  11. [[1, 2, 3, 4], [12, 13, 14, 5], [11, 16, 15, 6], [10, 9, 8, 7]]
  12. ]
Success #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
[[],[1],[1,2,3,4],[1,2,3,4,5,6,7,8,9],[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]]