(phixonline)-->
with javascript_semantics
function matrix_transpose(sequence mat)
integer rows = length(mat),
cols = length(mat[1])
sequence res = repeat(repeat(0,rows),cols)
for r=1 to rows do
for c=1 to cols do
res[c][r] = mat[r][c]
end for
end for
return res
end function