Common Lisp `row-major-aref` John Cowan (02 Sep 2023 06:08 UTC)
Re: Common Lisp `row-major-aref` Per Bothner (02 Sep 2023 15:35 UTC)
Re: Common Lisp `row-major-aref` John Cowan (02 Sep 2023 22:04 UTC)
(missing)
Re: Common Lisp `row-major-aref` Per Bothner (03 Sep 2023 04:32 UTC)
Re: Common Lisp `row-major-aref` John Cowan (03 Sep 2023 05:11 UTC)
Re: Common Lisp `row-major-aref` Bradley Lucier (09 Sep 2023 23:34 UTC)
Re: Common Lisp `row-major-aref` Per Bothner (11 Sep 2023 00:41 UTC)

Re: Common Lisp `row-major-aref` Per Bothner 02 Sep 2023 15:35 UTC


On 9/1/23 23:08, John Cowan wrote:
> In CL the function row-major-aref accepts an array and a single index *n* and returns the *n*th element of the array in row-major order.  There is a corresponding function (setf row-major-aref) serving as the corresponding mutator.  This is equivalent to:
>
> (define (row-major-aref array n)
>    (vector-ref (array->vector array) n))
>
> but does not reify the results of `array->vector`.  Is there some way to do this with SRFI 231?

In srfi-164 array->vector returns a view, not a copy.
So your define works, and the same approach works for setting.

It is unfortunate that array->vector is incompatible between srfi-231 and srfi-164.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/