RosettaCodeData/Task/Identity-matrix/SenseTalk/identity-matrix.sensetalk
2023-07-01 13:44:08 -04:00

28 lines
577 B
Text

set matrix to buildIdentityMatrix(3)
repeat for each item in matrix
put it
end repeat
set matrix to buildIdentityMatrix(17)
repeat for each item in matrix
put it
end repeat
function buildIdentityMatrix matrixSize
set matrixList to ()
repeat matrixSize times
set rowMatrixIndex to the counter
set rowMatrix to ()
repeat matrixSize times
if the counter equals rowMatrixIndex
insert 1 after rowMatrix
else
insert 0 after rowMatrix
end if
end repeat
insert rowMatrix nested after matrixList
end repeat
return matrixList
end buildIdentityMatrix