From d05cd6494c33b664bdef214185a90e8e2fbd0e46 Mon Sep 17 00:00:00 2001 From: karchnu Date: Sat, 16 Jan 2016 01:26:17 +0100 Subject: [PATCH] =?UTF-8?q?passage=20=C3=A0=20columnv4=20=3D>=20moins=20li?= =?UTF-8?q?sible,=20mais=20seulement=209=20lignes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- haskell/columnv4.hs | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 haskell/columnv4.hs diff --git a/haskell/columnv4.hs b/haskell/columnv4.hs new file mode 100644 index 0000000..1460948 --- /dev/null +++ b/haskell/columnv4.hs @@ -0,0 +1,9 @@ +import Data.List as L + +main = do + content <- getContents + putStr $ unlines $ map unwords $ L.transpose $ map formatLine $ L.transpose $ completeMatrix $ map words $ lines content + where completeMatrix m = map (\e -> e ++ [""| _ <- [length e..nb]]) m + where nb = maximum $ map length m + formatLine x = map (\e -> e ++ [' ' | _ <- [length e..nb]]) x + where nb = maximum $ map length x