Simplify a list of array allocations with a loop.