diff --git a/src/Maths/Transpose.hs b/src/Maths/Transpose.hs new file mode 100644 index 0000000..a14b8a9 --- /dev/null +++ b/src/Maths/Transpose.hs @@ -0,0 +1,9 @@ +module Maths.Transpose where + +-- Return the transpose of a matrix +transpose :: [[a]] -> [[a]] +transpose ([]:_) = [] +transpose x = (map head x) : transpose (map tail x) + +main = do + print (transpose [[1, 2, 3], [4, 5, 6]]) \ No newline at end of file