chickadee » generalized-arrays » array-squeeze-axis

array-squeeze-axis array axisprocedure

Removes the axis from the array's shape, if and only if the length of that axis is 1. If the length of that axis is not 1, an error is signalled. This procedure returns an array view (i.e. satisfies array-view?) without copying any of the array's internal data or modifying the underlying storage-object.

 
(import generalized-arrays
        test)

(define a (make-shape vector-storage-class (vector 2 1 2) 0))

(test "Squeezing array axis"
      (make-default-interval (vector 2 2))
      (array-shape
        (array-squeeze-axis a 1)))

(test-error "Squeezing an incorrect axis"
            (array-squeeze-axis a 0))