A recursive transpose removes the first column, then transposes the remaining columns:The internal recursive calls eventually reach rows of length zero, even though the original input has positive dimensions; the second equation handles this terminating case. Rectangularity ensures that the rows become empty together, so no
transpose :: Matrix a -> Matrix a
transpose [] = []
transpose ([] : _) = []
transpose rows = map head rows : transpose (map tail rows)head or tail is applied to an empty row in the third equation. The output is an matrix with entry . The element type is unrestricted. Articles by others on the same topic
There are currently no matching articles.