Original-Via: uk.ac.nsf; Wed, 6 Nov 91 14:43:35 GMT
Original-Sender: [EMAIL PROTECTED]



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 ...
                             ^
     (as it is on p. 86), i.e. substitute x to r in the test part.

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."

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...

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!

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.

                        /kent k

Reply via email to