Base-16 representation: Difference between revisions
Content added Content deleted
(→{{header|JavaScript}}: Added a JavaScript version.) |
|||
Line 875: | Line 875: | ||
<> show upperLimit |
<> show upperLimit |
||
<> ":\n", |
<> ":\n", |
||
table " " $ chunksOf 15 xs |
table justifyRight " " $ chunksOf 15 xs |
||
] |
] |
||
------------------------- DISPLAY ------------------------ |
------------------------- DISPLAY ------------------------ |
||
table :: |
table :: |
||
(Int -> Char -> String -> String) -> |
|||
⚫ | |||
String -> |
|||
⚫ | |||
[[String]] -> |
|||
pw = printf . flip intercalate ["%", "s"] . show |
|||
String |
|||
in unlines $ intercalate gap . zipWith pw ws <$> rows</lang> |
|||
⚫ | |||
unlines $ |
|||
fmap |
|||
( intercalate gap |
|||
. zipWith (`alignment` ' ') colWidths |
|||
) |
|||
rows |
|||
where |
|||
⚫ | |||
justifyRight :: Int -> Char -> String -> String |
|||
justifyRight n c = (drop . length) <*> (replicate n c <>)</lang> |
|||
{{Out}} |
{{Out}} |
||
<pre>301 matches up to 500: |
<pre>301 matches up to 500: |