The function length returns the length of a list; getMax returns the greatest element in a (non-empty) list of integers.length :: [a] -> Int length [] = 0 length (x:xs) = 1 + length xs getMax :: [Int] -> [Int] getMax [x] = x getMax (x:xs) = max x (getMax xs) getMax [] = error "can't apply getMax on an empty list!"
We can represent a matrix of integers as a list of type [[Int]]. Your assignment is to write a function that transposes a matrix. That is, if m is a matrix, every i-th row in m will become the i-th column in the transposed matrix.