Working on multidimensional arrays
What to use if you have a multidimensional array and you want to do something to each element?
row-major-aref can access an element in a multidimensional array with a single index. array-total-size returns the total number of elements in an array. Together, you can do something like this:
(dotimes (i (array-total-size array)) (incf (row-major-aref array i) 42))
You can also displace a one-dimensional array to the multidimensional array and work on it with sequence or vector functions:
(let ((vector (make-array (array-total-size array) :displaced-to array))) (fill vector 42))