import Data. Array ( Array, ( ! ) , ( // ) , bounds, listArray)
-- matrixes :: Int -> [[(Int, Int)]]
matrixes n
= go
1 . listArray
( 1 , 9 ) . repeat $ 9 where
go i rs
= let maxIndex
= snd ( bounds rs
) r = rs ! i
in if i > maxIndex then [ ]
else if r == 0 then go ( i + 1 ) rs
else map ( i :
) ( go
1 ( rs
// [ ( i
, ( rs
! i
) - 1 ) ] ) ) ++ go
( i
+ 1 ) rs
aW1wb3J0IERhdGEuQXJyYXkgIChBcnJheSwgKCEpLCAoLy8pLCBib3VuZHMsIGxpc3RBcnJheSkKCi0tIG1hdHJpeGVzIDo6IEludCAtPiBbWyhJbnQsIEludCldXQptYXRyaXhlcyBuID0gZ28gMSAuIGxpc3RBcnJheSAoMSwgOSkgLiByZXBlYXQgJCA5CiAgd2hlcmUKICAgIGdvIDo6IEludCAtPiBBcnJheSBJbnQgSW50IC0+IFtbSW50XV0KICAgIGdvIGkgcnMgPSBsZXQgbWF4SW5kZXggPSBzbmQgKGJvdW5kcyBycykgCiAgICAgICAgICAgICAgICAgIHIgICAgICAgID0gcnMgISBpCiAgICAgICAgICAgICAgaW4gIGlmICAgICAgaSA+IG1heEluZGV4IHRoZW4gW10KICAgICAgICAgICAgICAgICAgZWxzZSBpZiByID09IDAgICAgICAgdGhlbiBnbyAoaSArIDEpIHJzCiAgICAgICAgICAgICAgICAgIGVsc2UgICAgICAgICAgICAgICAgICAgICAgbWFwIChpIDopIChnbyAxIChycyAvLyBbKGksIChycyAhIGkpIC0gMSldKSkgKysgZ28gKGkgKyAxKSBycwoK
compilation info
[1 of 1] Compiling Main ( prog.hs, prog.o )
prog.hs:1:1: error:
The IO action ‘main’ is not defined in module ‘Main’
|
1 | import Data.Array (Array, (!), (//), bounds, listArray)
| ^
stdout