On Sat, 29 Nov 2008 15:57:50 +0200, Nikodemus Siivola wrote:
> On Fri, Nov 28, 2008 at 10:25 PM, Tamas K Papp <tkpapp@...> wrote:
>
>> A lot of the code in FFA was created to work around the fact that
>> sb-sys:vector-sap doesn't work for simple-arrays that have a rank
>> higher than 1. Currently the workaround is to create a simple array of
>> rank 1, and then displace to this when I need multidimensional arrays.
>>
>> I am about to redesign FFA, and I would like to ask if there is a
>> chance of getting this limitation removed, ie have sb-sys:vector-sap
>> work on array of rank higher than 1, or the introduction of another
>> function that would allow this. I know little of SBCL's internal
>> workings, is there anything that makes this impossible, or tricky, or
>> is it just that no one has asked for it yet?
>
> In SBCL a multidimensional simple-array has an underlying
> one-dimensional simple-array which holds the data. You can access it
> like so (though this is not officially supported, but support for it
> could possible be added.)
>
> (defun simple-array-vector (array)
> (declare (simple-array array))
> (if (sb-kernel:array-header-p array)
> (sb-kernel:%array-data-vector array)
> array))
>
> (simple-array-vector (make-array '(3 3) :initial-contents '((1 2 3) (4 5
> 6) (7 8 9))))
Thank you, this is exactly what I was looking for.
If feasible, please make this officially supported, and let me know when
it is, will then release the new version of FFA.
Thanks,
Tamas
|