Question about lists

Glynn Clements glynn.clements@virgin.net
Sun, 19 Jan 2003 23:03:34 +0000


cris cris wrote:

> To be honest I'm not very familiar with haskell and stuff
> so don't laugh with my question...
> here it goes..
> We can represent a matrix as a list of lists...
> which means that
> 		1 2 3
> 		4 7 6
> 		2 5 1
> could be written as follows: [[1,2,3],[4,7,6],[2,5,1]]
> The question is how can I reverse the matrix (each row becomes a column)

The "transpose" function in the List module does exactly that.

However, a list may not be the best choice here; an array would
probably be better.

-- 
Glynn Clements <glynn.clements@virgin.net>