From c20d0b6e0b5e6ba0d1388a98ccedeffa633a982a Mon Sep 17 00:00:00 2001 From: karchnu Date: Mon, 4 Jan 2016 14:01:50 +0100 Subject: [PATCH] =?UTF-8?q?Data.List=20pour=20faire=20une=20transpos=C3=A9?= =?UTF-8?q?e,=20plut=C3=B4t=20que=20de=20la=20recoder=20:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- haskell/column.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/haskell/column.hs b/haskell/column.hs index ebf9648..5a3b8d4 100644 --- a/haskell/column.hs +++ b/haskell/column.hs @@ -1,6 +1,4 @@ -transpose:: [[a]] -> [[a]] -transpose ([]:xs) = [] -transpose x = (map head x) : transpose (map tail x) +import Data.List as L addEmpty :: Int -> [a] -> [a] -> [a] addEmpty x v y @@ -21,7 +19,7 @@ completeMatrix m = map (addEmpty nb [""]) m where nb = maximum $ map length m column :: [[String]] -> [[String]] -column x = transpose $ formatLines $ transpose $ completeMatrix x +column x = L.transpose $ formatLines $ L.transpose $ completeMatrix x main = do content <- getContents