Show ASCII table: Difference between revisions
m
→{{header|Haskell}}: Tidied
(Add QB64) |
m (→{{header|Haskell}}: Tidied) |
||
Line 2,455:
import Data.List (transpose)
import Data.List.Split (chunksOf)
import Text.Printf (printf)
----------------------- ASCII TABLE ----------------------
main :: IO ()▼
main = putStrLn asciiTable▼
asciiTable :: String
asciiTable =
unlines $
(
<$> transpose
(chunksOf 16 $ asciiEntry <$> [32 .. 127])
Line 2,469:
asciiEntry n
| null k = k
| otherwise = concat [printf "%3d" n, " : ", k]
where
k = asciiName n
Line 2,483 ⟶ 2,481:
| otherwise = [chr n]
--------------------------- TEST -------------------------
▲main :: IO ()
▲main = putStrLn asciiTable
</lang>
{{Out}}
<pre> 32 : Spc 48 : 0 64 : @ 80 : P 96 : ` 112 : p
|