- array-squeeze arrayprocedure
Removes all axes in the array's shape whose length is 1. If every axis would be squeezed by this operation, returns the singular value in the array. 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-array-from-storage vector-storage-class (vector 3 1 3) (vector 'a 'b 'c 'd 'e 'f 'g 'h 'i))) (test "Squeeze array axes" (make-default-interval (vector 3 3)) (array-shape (array-squeeze a))) (test "Get single value from slice" 'e (array-squeeze (array-slice a #(1 0 1) #(2 1 2))))