RosettaCodeData/Task/Identity-matrix/Haskell/identity-matrix-5.hs
2023-07-01 13:44:08 -04:00

7 lines
183 B
Haskell

idMatrix :: Int -> [[Int]]
idMatrix n =
let xs = [1 .. n]
in (\x -> fromEnum . (x ==) <$> xs) <$> xs
main :: IO ()
main = (putStr . unlines) $ unwords . fmap show <$> idMatrix 5