## Lists and Recursion

Here are few examples of how to write functions that recursively process a list:
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!"
The function length returns the length of a list; getMax returns the greatest element in a (non-empty) list of integers.

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.

• First, define the function transpose using explicit recursion.
• Make sure that your function also gives the desired result for the empty list [] and the list containing the empty list, that is, [[]].
• What happens if the elements in the list passed to transpose are lists that differ in their length?
• Bonus: define the transpose function using standard higher-order functions from the Prelude (such as map and foldr), or use list comprehensions.