Replace loops with array slices.