Name: Anonymous 2008-04-15 9:09
Can someone post picturse of the late Haskell? Also, what type of dog was she?
Prelude> let wide = lambda s: ''.join([unichr(0xfee0 + ord(c)) for c in s]).replace(unichr(0xff00), unichr(0x3000))
<interactive>:1:22: lexical error in string/character literal at character '\''
cleanChars s@(c:cs) = case find (flip isPrefixOf s.fst) rep of
Just (p,r) -> r : (cleanChars.drop (length p)) s
Nothing -> cleanChar c : cleanChars cs
where cleanChar c | c >= ' ' && c <= '~' = (chr.(+0xFEE0).ord) c
cleanChar c = c
rep = [("...",'\x2026'),("?!",'\x203D'),("??",'\x2047'),
("!?",'\x2049'),("!!",'\x203C'),
("``",'\x275D'),("''",'\x275E'),
(" ",'\x3000'),("`",'\x275B'),("'",'\x275C')]
cleanChars _ = ""
cleanChars [] = []
cleanChars s =
head $ mapMaybe (\(a, u) -> fmap ((u:) . cleanChars) $ stripPrefix a s) rep
where
rep = [("...",'\x2026'), ("?!",'\x203D'), ("??",'\x2047'),
("!?", '\x2049'), ("!!",'\x203C'), ("``",'\x275D'),
("''", '\x275E'), (" ", '\x3000'), ("`", '\x275B'),
("'", '\x275C')] ++ map (\c -> ([chr c], chr (c + 0xfee0))) [0..]
cleanChars [] = []
cleanChars s =
head $ mapMaybe (\(a, u) -> fmap ((chr u:) . cleanChars) $ stripPrefix a s) rep
where
rep = [("...", 0x2026), ("?!", 0x203D), ("??", 0x2047),
("!?", 0x2049), ("!!", 0x203C), ("``", 0x275D),
("''", 0x275E), (" ", 0x3000), ("`", 0x275B),
("'", 0x275C)] ++ map (\c -> ([c], ord c + 0xfee0)) [' '..'~']
++ map (\o -> ([chr o], o)) [0..]