function reshape( x, fromShape, toShape, colexicographic ) {
	var f = flatten( x, fromShape, colexicographic );
	return recurse( f, toShape.length, toShape, 0, 0 );
}
Reshape a nested array into another nested array having a desired shape.

@param {Array} x - input nested array
@param {NonNegativeIntegerArray} fromShape - shape of the input array
@param {NonNegativeIntegerArray} toShape - shape of the output array
@param {boolean} colexicographic - specifies whether to reshape the array in colexicographic order
@returns {Array} output nested array

@example
var x = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ];

var out = reshape( x, [ 2, 3 ], [ 3, 2 ], false );
// returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]