chickadee » generalized-arrays » array-reclassify

array-reclassify array storage-classprocedure

Reclassifies the storage of an array by copying the data to a newly constructed array and storage-object of the provided storage-class.

(import generalized-arrays

(define a
  (make-array vector-storage-class #(3 3) 0))

;; Reclassify into f32vector storage
(define b
  (array-reclassify a f32vector-storage-class))

(test-assert "Original array holds vector storage object"
  (vector? (array-storage-object b)))

(test-assert "Reclassified array holds f32vector storage object"
  (f32vector? (array-storage-object b)))