正在加载图片...
6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology Slide 15.7.17 and as we saw from our earlier work, plus* would be Defining a named procedure represented by a primitive procedure, in this case as list (lambda* (x*)(plus* x* x*)))GE) structure with a tag identifying it as a primitive and a pointer to the actual primitive code. Remember that this was installed in the global environment when we loaded up our evaluator PLus Defining a named procedure Slide 15.7.18 (eva1’( define* twice That is, there is a pointer from plus* in the global (lambda* (x*) (plus* x* x*)))GE) environment(that table)to the actual representation of the bject 卫1m包 dure Slide 15.7.19 Defining a named procedure So what happens when we evaluate the expression shown at the (eval ,(define* twice* top? Eval will dispatch this to eval-define which (lambda* (x*)(plus* x* x*)))GE will create a binding for the symbol twice* in the environment, to the value returned by evaluating (lambda* (x*)(plus* x* x*)).We know what that latter 七Wice rocedure evaluation will return, that is the thing we just saw and it gives us back this structure symbol[ 4I+AB-L symbol plus* Defining a named procedure Slide 15.7.20 We do need to worry about where the environment part of the (eval ,(define* twice (lambda* (x*)(plus* x* x *))) structure points to, and we know it should point to the environment in which the evaluation was done, hence to this twice symbolIa A+LV6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 15.7.17 ... and as we saw from our earlier work, plus* would be represented by a primitive procedure, in this case as list structure with a tag identifying it as a primitive and a pointer to the actual primitive code. Remember that this was installed in the global environment when we loaded up our evaluator. Slide 15.7.18 That is, there is a pointer from plus* in the global environment (that table) to the actual representation of the object. Slide 15.7.19 So what happens when we evaluate the expression shown at the top? Eval will dispatch this to eval-define which will create a binding for the symbol twice* in the environment, to the value returned by evaluating (lambda* (x*) (plus* x* x*)). We know what that latter evaluation will return, that is the thing we just saw and it gives us back this structure. Slide 15.7.20 We do need to worry about where the environment part of the structure points to, and we know it should point to the environment in which the evaluation was done, hence to this frame
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有