code for the transpose of list of lists



Pedro Garrido gomez wrote:
>
>  The big difference in transpose-pg is that it cons very little, only 
> one row of the matrix.
>  The algorithm is about changing pointers in the original matrix to 
> get the tranpose.
>
This is an interesting exercise, but not necessarily a fast way of doing 
things.

Why not use up memory, temporarily,  to make your job easier?

   For example, a 600X600
matrix of 32 bit pointers can be allocated pretty fast, and takes 4X 
600X600  =  1.44 megabytes.
Not much memory.  Especially if you return it all in one chunk, it is 
not hard to manage.
Even using up a bunch of conses may not be slow, with a good garbage 
collector.

If people are going to be doing numerical operations on arrays of 
substantial size, it may be useful to
support "true" arrays, say of double-float numbers.  Mathematica does 
something like this.
Maybe some of the Maxima packages do it too??

RJF