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 Kent for pointing these Haskell typos out.
Simon
| From: Kent Karlsson <[EMAIL PROTECTED]>
| Date: Wed, 6 Nov 91 14:37:15 +0100
|
| 1. On p. 57, middle of figure 8 it says:
|
| x `mod` y = if signum x == -(signum y) ...
| it should be:
| x `mod` y = if signum r == -signum y ...
Right.
| 2. And on p. 81 add as the first clause of the definition of gcd:
|
| gcd 0 0 = error "gcd{Prelude}: gcd 0 0 is undefined."
Right.
| 3. P. 22, Semantics of n+k patterns:
|
| case e0 of {x+k -> e; _ -> e';}
| = if e0 >= k then let x = e0-k in e else e'
|
| What if x occurs in e0? I know what it says on p. 21, but I don't
| like it, since this 'let' has the same syntax as the ordinary recursive
| let.
|
| 4. Still p. 22, Semantics of (K x1 ... xn) patterns;
| I'm (now :-) surprised to find that xj (j<i) are in scope in ei:
|
| case K e1 ... en of {K x1 ... xn -> e; _ -> e';}
| = case e1 of {x1 -> ... case en of {xn -> e}...}
|
| I understand that the two last cases ((k) and (l)) are supposed to be
| 'dynamic' in nature (i.e. e1...en should be closures), rather than
| syntactic, but read to the letter...
Yurgh! You are right, even if the intention is clear enough. I suppose
we should make (h) into
case e0 of {x+k -> e; _ -> e';}
= if e0 >= k then let x' = e0-k in e[x'/x] else e'
where x' is a completely new variable
and (l) into
case K e1 ... en of {K x1 ... xn -> e; _ -> e';}
= case e1 of {x1' -> ... case en of {xn' -> e[x1'/x1...xn'/xn]}...}
where x1'...xn' are completely new variables
| 5. And, if I continue to read to the letter, an expression like
| case y of {K x1 ... xn -> e; _ -> e';}
| where y is a variable (or is an expression of another form than
| K' e1 ... em), has no semantics!
I disagree. If you keep transforming then you get down to primitive
case expressions of this form. They are the ones which are actually
executed!
| 6. Case (f), in the semantics for case-expressions, loops! It needs a
| restriction saying that at least one of p1...pn is not a variable.
Right.
Simon