Let’s say I wrote
(setf s (make-array (list 9 9) :element-type 'bit))
so s is a 9×9 matrix of bits.
and I want to get the 1st row of s. How do I get that?
I could have done the following:
(setf s (make-array 9
:element-type 'array
:initial-element
(make-array 9 :element-type 'bit)))
and access the first row by (svref s 0).
But I want to know if there is a built-in way.
(And the 2 dim array seems to allocate less bytes).
This only works for row slices and doesn’t, IIRC, copy the array. Writing to the slice will modify the original array.