2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
13
Task/Identity-matrix/JavaScript/identity-matrix-2.js
Normal file
13
Task/Identity-matrix/JavaScript/identity-matrix-2.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
(() => {
|
||||
|
||||
// idMatrix :: Int -> [[0 | 1]]
|
||||
const idMatrix = n => Array.from({
|
||||
length: n
|
||||
}, (_, i) => Array.from({
|
||||
length: n
|
||||
}, (_, j) => i !== j ? 0 : 1));
|
||||
|
||||
|
||||
// TEST
|
||||
return idMatrix(5);
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue