matrix_transpose() generalized to transpose()

This commit is contained in:
Revar Desmera
2019-05-12 12:32:03 -07:00
parent a5065c1595
commit 78e3cd3c27
3 changed files with 34 additions and 21 deletions

View File

@@ -212,4 +212,13 @@ module test_array_dim() {
test_array_dim();
module test_transpose() {
assert(transpose([[1,2,3],[4,5,6],[7,8,9]]) == [[1,4,7],[2,5,8],[3,6,9]]);
assert(transpose([[1,2,3],[4,5,6]]) == [[1,4],[2,5],[3,6]]);
assert(transpose([3,4,5]) == [[3],[4],[5]]);
}
test_transpose();
// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap