Original-Via: uk.ac.ic.doc; Mon, 28 Oct 91 15:16:11 GMT
Tony Davie <[EMAIL PROTECTED]> wrote:
>The functions toUpper and toLower in the standard prelude (p 80) have
>initial definitions which should read:
>
>toUpper c | isLower c = chr (ord c - (ord 'A' - ord 'a'))
>
>and
>
>toLower c | isUpper c = chr (ord c - (ord 'a' - ord 'A'))
Close, but no banana! How about:
toUpper c | isLower c = chr (ord c - ord 'a' + ord 'A')
| otherwise = c
toLower c | isUpper c = chr (ord c - ord 'A' + ord 'a')
| otherwise = c
Ie. just remove the innermost parentheses from the original version.
Denis Howe <[EMAIL PROTECTED]> I don't really love computers, I just
H558A Imperial College London say that to get them into bed with me.
+44 (71) 589 5111 x5064/x7531 T Pratchet