正在加载图片...
6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology Slide 12.3.29 and our name rule says to simply look it up with respect to Example contd:(square y)I this environment chain starting in el. This. of course. returns the value 4 tnc-square (square y)) Y K== 6001C EXample cont'd: (square y)E Slide 12.3.30 So we are set for our big rule again. We have the application of inc-square a procedure, one of those double bubbles, to a set of value Step one says: drop a frame P: Y +1 6001 9ICP Slide 12.3.31 Example contd: (square y)Ie Extend that frame into an environment by having its enclosing environment pointer match that specified by the procedure object 1 (square y)) square nI => #[compound] y KI == 4 Example contd: (square y)Ig Slide 123.32 which says we want this one. Notice an interesting point here. This new environment E2 is scoped by the global environment, not by El. You might have thought this should be el because that was where we were doing the evaluation but remember that rule says the enclosing environment is specified by the procedure being applied, not by the frame in b: (* xx) which we are doing the evaluation (square y)) square In=>#[compound] yIn==>4 1001 iCP6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 12.3.29 ... and our name rule says to simply look it up with respect to this environment chain starting in E1. This, of course, returns the value 4. Slide 12.3.30 So we are set for our big rule again. We have the application of a procedure, one of those double bubbles, to a set of values. Step one says: drop a frame. Slide 12.3.31 Extend that frame into an environment by having its enclosing environment pointer match that specified by the procedure object... Slide 12.3.32 ... which says we want this one. Notice an interesting point here. This new environment E2 is scoped by the global environment, not by E1. You might have thought this should be E1, because that was where we were doing the evaluation, but remember that rule says the enclosing environment is specified by the procedure being applied, not by the frame in which we are doing the evaluation
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有