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

4 lines
113 B
Haskell

idMatrix :: Int -> [[Int]]
idMatrix n =
let xs = [1 .. n]
in xs >>= \x -> [xs >>= \y -> [fromEnum (x == y)]]