6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology Slide 5.1.11 And here is how to do this sqrt-Block Structure Note that the definition of sart bind this name to a lambda Within the bounds of that lambda we have moved the (define good-enut? (lambda (guess) (square quess) x) definitions for improve, good-enuf?, and sart (det ine inprove (lambda (guess) iter(which is what we have renamed try). By moving (detine sqrt-iter (lambda (guess) (if (goodl-enur? guess) these procedures inside the body of the lambda, they become (sgrt-iter (inprove quess)))) sgrt-iter1.0〕) internal procedures, accessible only to other expressions within the body of that lambda. That is, if we try to refer to one of these names when interacting with the evaluator, we will get an unbound variable error. But these names can be referenced by 4 6001 SCP expressions that exist within the scope of this lambda The rules of evaluation say that when we apply sgrt to some argument, the body of this lambda will be evaluated. At that point, the internal definitions are evaluated The final expression of the lambda is the expression (sqrt-iter 1. 0)which means when sqrt is applied to some argument, by the substitution model it will reduce to evaluating this expression, meaning it will begin the recursive evaluation of guesses for the square root sqrt-Block Structure Slide 5.1.12 In fact we can stress this by drawing a box around the boundary ine good-enuf? (lambda (guess) of the outermost lambda. Clearly that boundary exactly scopes the black box abstraction that i wanted define inprove (lambda (guess) (average gsess ( x guess))) This is called block structure, which you can find, discussed in if《good-muf? quess more detail in the textbook sgrt-iter (improve guess))))) 1.0〕 600I SIcp Slide 5.1.13 qrt-Block Structure Schematically, this means that sqrt contains within it only those internal procedures that belong to it, and behaves t ine good-eauf?(⊥ anda《9uess square quess) x) according to the contract expected by the user, without the user det ine inprove lambda (guess knowing how those procedures accomplish this contract (det ine sqrt-iter (lambda (guess) his provides another method for abstracting ideas and isolating them from other abstractions (sgrt-iter (iprove guess))))) 6001 sCP6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 5.1.11 And here is how to do this. Note that the definition of sqrt bind this name to a lambda. Within the bounds of that lambda we have moved the definitions for improve, good-enuf?, and sqrtiter (which is what we have renamed try). By moving these procedures inside the body of the lambda, they become internal procedures, accessible only to other expressions within the body of that lambda. That is, if we try to refer to one of these names when interacting with the evaluator, we will get an unbound variable error. But these names can be referenced by expressions that exist within the scope of this lambda. The rules of evaluation say that when we apply sqrt to some argument, the body of this lambda will be evaluated. At that point, the internal definitions are evaluated. The final expression of the lambda is the expression (sqrt-iter 1.0) which means when sqrt is applied to some argument, by the substitution model it will reduce to evaluating this expression, meaning it will begin the recursive evaluation of guesses for the square root. Slide 5.1.12 In fact we can stress this by drawing a box around the boundary of the outermost lambda. Clearly that boundary exactly scopes the black box abstraction that I wanted. This is called block structure, which you can find, discussed in more detail in the textbook. Slide 5.1.13 Schematically, this means that sqrt contains within it only those internal procedures that belong to it, and behaves according to the contract expected by the user, without the user knowing how those procedures accomplish this contract. This provides another method for abstracting ideas and isolating them from other abstractions