Data.List pour faire une transposée, plutôt que de la recoder :)
This commit is contained in:
parent
7748cd19bf
commit
c20d0b6e0b
@ -1,6 +1,4 @@
|
|||||||
transpose:: [[a]] -> [[a]]
|
import Data.List as L
|
||||||
transpose ([]:xs) = []
|
|
||||||
transpose x = (map head x) : transpose (map tail x)
|
|
||||||
|
|
||||||
addEmpty :: Int -> [a] -> [a] -> [a]
|
addEmpty :: Int -> [a] -> [a] -> [a]
|
||||||
addEmpty x v y
|
addEmpty x v y
|
||||||
@ -21,7 +19,7 @@ completeMatrix m = map (addEmpty nb [""]) m
|
|||||||
where nb = maximum $ map length m
|
where nb = maximum $ map length m
|
||||||
|
|
||||||
column :: [[String]] -> [[String]]
|
column :: [[String]] -> [[String]]
|
||||||
column x = transpose $ formatLines $ transpose $ completeMatrix x
|
column x = L.transpose $ formatLines $ L.transpose $ completeMatrix x
|
||||||
|
|
||||||
main = do
|
main = do
|
||||||
content <- getContents
|
content <- getContents
|
||||||
|
Loading…
Reference in New Issue
Block a user