chickadee » generalized-arrays » array-copy!

array-copy! to at from #!optional start endprocedure

Copies the elements of array from into the array to starting at index at. If start and end are provided, these specify the array interval inside from to copy across. An error is signaled if the shapes of the array to and the interval specified by start and end are incongruent.

 
(import generalized-arrays
        test)

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

(define b
  (make-array vector-storage-class #(4 4) 1))

(array-copy! (array-slice a #(1 1) #(3 3))
             (vector 0 0)
             b)

(test-assert "Array a has had its lower corner copied from b"
  (array=? a
           (make-array-from-storage vector-storage-class
                                    #(3 3)
                                    (vector 0 0 0
                                            0 1 1
                                            0 1 1))))