chickadee » generalized-arrays » array-broadcast

array-broadcast array valueprocedure

Constructs a new array by copying the storage-class and shape of the input array and setting all the elements of the newly allocated array to the provided value.

 
(import generalized-arrays
        test)

(define a (make-array vector-storage-class #(3 3) 0))
(define b (array-broadcast a "abc"))

(test "Shapes of arrays are the same."
      (array-shape a)
      (array-shape b))

(test "Storage class of arrays are the same."
      (array-storage-class a)
      (array-storage-class b))