Anonymous user
Matrix transposition: Difference between revisions
m
→{{header|REXX}}: added/changed some comments and whitespace, used a more idiomatic parsing of the @ array.
m (→{{header|REXX}}: added/changed some comments and whitespace, used a more idiomatic parsing of the @ array.) |
|||
Line 2,729:
@.=; @.1 = 1.02 2.03 3.04 4.05 5.06 6.07 7.08
@.2 = 111 2222 33333 444444 5555555 66666666 777777777
w=0
do row=1 while @.row\==''▼
row= row-1
do
call showMat 'A', row, col /*display the A matrix to terminal.*/
call showMat 'B', col, row /* " " B " " " */
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
showMat: arg mat,rows,cols; say; say center( mat 'matrix', (
do r=1 for rows; _= /*newLine*/
do c=1 for cols; _=_ right( value( mat'.'r"."c),
end /*c*/
say _ /*1 line.*/
▲ end /*c*/
end /*r*/; return</lang>
{{out|output|text= when using the default input:}}
|