This matrix transposition function works, but I'm trying to understand its step by step execurtion and I don't get it.
transpose:: [[a]]->[[a]]
transpose ([]:_) = []
transpose x = (map head x) : transpose (map tail x)
with
transpose [[1,2,3],[4,5,6],[7,8,9]]
it returns:
[[1,4,7],[2,5,8],[3,6,9]]
I don't get how the concatenation operator is working with map. It is concatenating each head of x in the same function call? How?
is this
(map head x)
creating a list of the head elements of each list?