method vector.vector_to_2d_vector
Contract
Return typewob
Parameter keyDefault valueType
columnsopt
rowsopt
Water Contract
<method vector.vector_to_2d_vector
  columns=opt
  rows   =opt/>
This method converts a one dimenesion vector into a 2 dimensional vector. The returned 2d vector will have the same 'leaf' elements as the original vector but they will be nested inside of other vectors.
One use of this method is when you have a bunch of elements in a vector that you want to lay out on the screen and there's too many of them to fit in one row or column. You can use vector_to_2d_vector to split them up into rows and columns. You must supply an argument, either the 'rows' argument or the 'columns' argument.
'rows' constrains the output to have exactly that number of rows. Elements from the original vector are put top to bottom into the first column, then top to bottom into the 2nd column, etc until all the elements from the original vector have been used up. The number of columns in the output is unconstrained.
'columns' constrains the output to have exactly that number of columns. Elements from the original vector are put left to right into the first row, then left to right into the 2nd row, etc until all the elements from the original vector have been used up. The number of rows in the output is unconstrained.
The output 2d vector need not have its last row or column filled up.
<v 10 11 12 13 14 15 16 17 18/>.<vector_to_2d_vector columns=4/>
<vector <vector 10 11 12 13/> <vector 14 15 16 17/> <vector 18/>/>
<v 10 11 12 13 14/>.<vector_to_2d_vector rows=2/>
<vector <vector 10 12 14/> <vector 11 13/>/>