Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,33 @@
import Data.Char (chr)
import Data.List (transpose)
import Data.List.Split (chunksOf)
import Text.Printf (printf)
----------------------- ASCII TABLE ----------------------
asciiTable :: String
asciiTable =
unlines $
(printf "%-12s" =<<)
<$> transpose
(chunksOf 16 $ asciiEntry <$> [32 .. 127])
asciiEntry :: Int -> String
asciiEntry n
| null k = k
| otherwise = concat [printf "%3d" n, " : ", k]
where
k = asciiName n
asciiName :: Int -> String
asciiName n
| 32 > n = []
| 127 < n = []
| 32 == n = "Spc"
| 127 == n = "Del"
| otherwise = [chr n]
--------------------------- TEST -------------------------
main :: IO ()
main = putStrLn asciiTable