Path: utzoo!attcan!uunet!comp.vuw.ac.nz!virtue!math1205 From: math1205@waikato.ac.nz Newsgroups: comp.lang.scheme Subject: Internal Definitions Message-ID: <904.268b61d9@waikato.ac.nz> Date: 29 Jun 90 02:12:41 GMT Organization: University of Waikato, Hamilton, New Zealand Lines: 32 In a book by H. Abelson & G. Sussman entitled "Structure and Interpretation of Computer Programs" (1985) there is a section on the evaluation of internal definitions (pp. 439-442). In here they show there are several ways to evaluate multiple internal definitions which can lead to inconsistent results when the definitions reference each other. For example, the expression (let ((a 1)) (define (f x) (define b (+ a x)) (define a 5) (+ a b)) (f 10)) can return different results depending on whether the definition of a and b are evaluated simultaneously or in sequence; returning 20 or 16 resp. The book suggests a simultaneous evaluation of definitions is the desired approach, but because this is difficult to implement, they note the MIT implementors of Scheme generate an error in the above case. As I see the Scheme description given in R^nRS, expressions in the body of f should be evaluated in sequence and therefore the above should return 16. Who agrees/disagrees? Also in the DEC Scheme->C implementation the above expression returns the rather confusing value of 15. I assume this is caused by a having the value of 0 when the definition of b is evaluated. I think this is a bug! Who agrees/disagrees? -Wayne Schou math1205@waikato.ac.nz