Commit 98f34fe9 authored by simonmar's avatar simonmar
Browse files

[project @ 2005-03-15 12:34:40 by simonmar]

new unicode test, and accept output
parent 203c00b1
......@@ -8,7 +8,7 @@
'\DEL' X
'\187' X
'\913' X X X X
'\2534' X X X
'\2534' X X
'\8194' X X
'\66352' X X X
'\120822' X X X
'\120822' X X
module Main where
import Char
import Numeric
header = "Code C P S U L A D"
preds = [
isControl,
isPrint,
isSpace,
isUpper,
isLower,
isAlpha,
isDigit]
prtBool :: Bool -> String
prtBool True = "T "
prtBool False = "F "
showCode :: Char -> Int -> String
showCode c w = code ++ pad
where
code = show (ord c)
l = length code
spaces = map anytospace [1..]
anytospace _ = ' '
pad | l >= w = ""
| otherwise = take (w - l) spaces
charCode :: Char -> String
rapply a b = b a
charCode c = (showCode c 5) ++ (foldr1 (++) $ map prtBool $ map (rapply c) preds)
main = do
putStrLn header
mapM (putStrLn . charCode) [ (chr 0) .. (chr 6553) ]
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment