Thu, 14 Sep 2000 16:10:46 +0200, Karlsson Kent - keka <[EMAIL PROTECTED]> pisze:

> I.e., there should be no "compiled in" "knowledge" that the
> characters that were of category Cn are "unprintable".

What should the following functions return, assuming they are designed
now (for Haskell)? What else should be provided? I am putting here
current definitions:

isControl  c = c < ' ' || c >= '\x7F' && c <= '\x9F'
isPrint    c = category is other than [Zl,Zp,Cc,Cf,Cs,Co]
isSpace    c = one of "\t\n\r\f\v" || category is one of [Zs,Zl,Zp]
isGraph    c = isPrint c && not (isSpace c)
isPunct    c = isGraph c && not (isAlphaNum c)
isAlphaNum c = category is one of [Lu,Ll,Lt,Nd,Nl,No,Lm,Lo]
isHexDigit c = isDigit c || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f'
isDigit    c = c >= '0' && c <= '9'
isOctDigit c = c >= '0' && c <= '7'
isAlpha    c = category is one of [Lu,Ll,Lt,Lm,Lo]
isUpper    c = category is one of [Lu,Lt]
isLower    c = category is Ll
isLatin1   c = c <= '\xFF'
isAscii    c = c < '\x80'

isDigit intentionally recognizes ASCII digits only. IMHO it's more
often needed and this is what the Haskell 98 Report says. But I don't
follow the report in some other cases.

Titlecase could be handled too. Even then I think that isUpper should
be True for titlecase letters. But perhaps it's enough to have toTitle
in addition to toUpper and toLower, because what could isTitle be
used for?

-- 
 __("<  Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK

-
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/lists/

Reply via email to