// input : list of numbers
// output : sorted list of numbers
function quicksort(arr) = !(len(arr)>0) ? [] : let(
    pivot   = arr[floor(len(arr)/2)],
    lesser  = [ for (y = arr) if (y  < pivot) y ],
    equal   = [ for (y = arr) if (y == pivot) y ],
    greater = [ for (y = arr) if (y  > pivot) y ]
) concat(
    quicksort(lesser), equal, quicksort(greater)
);

module cuben(name, size){
	cube(size=size, center=false);
	// sizes should be ordered biggest to smallest
	size_sorted=quicksort(size);
	echo(str("#### ", name, ": " , size_sorted[2], "x", size_sorted[1], "x", size_sorted[0]));
};
