X-Comment1: #############################################################
X-Comment2: #     uk.ac.glasgow.cs has changed to uk.ac.glasgow.dcs     #
X-Comment3: #     If this address does not work please ask your mail    #
X-Comment4: #     administrator to update your NRS & mailer tables.     #
X-Comment5: #############################################################


Thanks to Tony for spotting another typo.  I prefer to put in
enough parens to make it unambiguous.  The definitions of toUpper
and toLower should read:

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

Simon

------- Forwarded Message

Date:    Mon, 28 Oct 91 15:11:44 +0000
From:    Denis Howe <[EMAIL PROTECTED]>
To:      [EMAIL PROTECTED]
cc:      haskell
Subject: More typos



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

------- End of Forwarded Message


Reply via email to