- array-update! array idx procprocedure
Updates the element in the array at idx as if applying proc to it.
(import generalized-arrays test) (define a (make-array-from-storage vector-storage-class (vector 3 3) (vector 1 2 3 4 5 6 7 8 9))) (test "Element at #(1 1) is equal to 5" 5 (array-ref a #(1 1))) (array-update! a #(1 1) (lambda (elem) (- elem 20))) (test "Element at #(1 1) is now equal to -15" -15 (array-ref a #(1 1)))