language: Haskell (ghc-7.4.1)
date: 216 days 20 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
dim :: [[a]] -> (Int, Int)
dim ls = let x = length ls
             ys = map length ls
         in case ys of
             h:t -> if all (==h) t then (x, h) else (0, 0)
             [] -> (0, 0)
 
main = do
   print $ dim [[1, 1], [1, 1]]
   print $ dim [[1, 1], [2, 2, 2]]