function recurse( value, ndims, shape, dim, out ) {
	var S;
	var d;
	var i;

	S = shape[ dim ];

	// Check whether we're filling the last dimension:
	d = dim + 1;
	if ( d === ndims ) {
		return filled( value, S );
	}

	// Fill nested dimensions...
	for ( i = 0; i < S; i++ ) {
		out.push( recurse( value, ndims, shape, d, [] ) );
	}
	return out;
}
Recursive fills an array.

@private
@param {*} value - fill value
@param {NonNegativeInteger} ndims - number of dimensions
@param {NonNegativeIntegerArray} shape - array shape
@param {NonNegativeInteger} dim - dimension index
@param {Array} out - output array
@returns {Array} output array