How to flatten an array by one level

I have an array of arrays of arrays. I want to flatten by one level so that I have an array of arrays. Flatten takes the 3d array to a 1d array, but I want a 2d array. How can I do this?

#range(3,7).map(x => {
  range(3,7).map(y => {
    (x,y)
  })
}).flatten()

^ flattens to array of ints, want array of (int, int).

I think you’re looking for join() or sum()? (join is more explicit so should probably be preferred)

2 Likes