chickadee » generalized-arrays » array-expand-axis

array-expand-axis array axisprocedure

Adds an axis of length 1 before axis to the internal shape of 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.

This procedure can be though of as the opposite of array-squeeze-axis.

 
(import generalized-arrays
        test)
(define a
  (make-array-from-storage vector-storage-class
                           (vector 3 3)
                           (vector 'a 'b 'c
                                   'd 'e 'f
                                   'g 'h 'i)))

(test "Shape of expanded array"
      (make-default-interval (vector 1 3 3))
      (array-shape
        (array-expand-axis a 0)))