Use similar instead of Array in array.jl

Following up on #6167. There are some functions in `array.jl` that need this change as well.