reshare array

Tamas K Papp <[email protected]>
Newsgroups gmane.lisp.cmucl.general
Message-ID <[email protected]>
Hi,

I am a Lisp newbie, sorry if this question has a simple answer, I
tried googling and found nothing.

Consider an n-dimensional simple array, eg

(setf a (make-array '(2 3 4) :element-type 'double-float))

If I understand correctly, a simple boxed array is just a vector of
numbers (in this case, 12 zeros), and information on the dimension (2
3 4).  Is it possible to "reshape" the array by changing only the
latter?  Eg 

(reshape a '(4 3))

would give a 4x3 array with the same elements, etc.  A special case
would be reshaping to a simple vector, or reshaping a simple vector to
an array.

Is there such a function already in CMUCL, or is it possible to write
one without too much hassle?  Even a desctructive reshape! would be
enough for my purposes.

Thanks,

Tamas


PS. matlisp already has such a reshape, but only for matrices.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.