chickadee » generalized-arrays » array-set!

array-set! array idx valueprocedure

Sets the element in array at idx to the provided value. Analagous to something like vector-set!, but for arrays.

 
(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-set! a #(1 1) "abc")

(test "Element at #(1 1) is now equal to 'abc'"
      "abc"
      (array-ref a #(1 1)))