The shape of the result array must be obtained from the shape of the source array by deleting dimension dim (see section 4.4).