RosettaCodeData/Task/Identity-matrix/Haskell/identity-matrix-4.hs

5 lines
113 B
Haskell
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
idMatrix :: Int -> [[Int]]
idMatrix n =
let xs = [1 .. n]
in xs >>= \x -> [xs >>= \y -> [fromEnum (x == y)]]