Show ASCII table: Difference between revisions
m
→{{header|Haskell}}: Applied Ormolu
m (fix category) |
m (→{{header|Haskell}}: Applied Ormolu) |
||
Line 1,816:
=={{header|Haskell}}==
<lang haskell>import Data.
import Data.List (transpose)
import Data.
main :: IO ()
main = putStrLn asciiTable
asciiTable :: String
asciiTable =
unlines $
(justifyLeft 12 ' ' =<<)
<$> transpose
asciiEntry :: Int -> String
asciiEntry n
| null k = k
| otherwise =
concat
[justifyRight 4 ' ' (show n), " : ", k]
where
k = asciiName n
asciiName :: Int -> String
asciiName n
Line 1,843 ⟶ 1,846:
| 127 == n = "Del"
| otherwise = [chr n]
justifyLeft, justifyRight :: Int -> Char -> String -> String
justifyLeft n c s = take n (s <> replicate n c)
justifyRight n c = (drop . length) <*> (replicate n c <>)</lang>
{{Out}}
|