avoid unncessary padding on last column in table
This commit is contained in:
parent
56539e79e0
commit
95d1cc62ea
|
@ -22,7 +22,8 @@ formatTable table = map (\r -> unwords (map pad (zip r rowsizes))) table
|
||||||
where
|
where
|
||||||
pad (cell, size) = cell ++ take (size - length cell) padding
|
pad (cell, size) = cell ++ take (size - length cell) padding
|
||||||
padding = repeat ' '
|
padding = repeat ' '
|
||||||
rowsizes = sumrows (map (map length) table)
|
rowsizes = reverse $ (0:) $ drop 1 $ reverse $
|
||||||
|
sumrows (map (map length) table)
|
||||||
sumrows [] = repeat 0
|
sumrows [] = repeat 0
|
||||||
sumrows [r] = r
|
sumrows [r] = r
|
||||||
sumrows (r1:r2:rs) = sumrows $ map (uncurry max) (zip r1 r2) : rs
|
sumrows (r1:r2:rs) = sumrows $ map (uncurry max) (zip r1 r2) : rs
|
||||||
|
|
Loading…
Reference in New Issue