正在加载图片...
6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology Slide 12.4.9 Here's a recap of the environment structure. We have the global(ca)I environment with a binding for ca, which points to a procedure object whose environment pointer points to a new GE4 make-counter frame, or environment, El. This frame is scoped by the global environment, but contains within it its own local variable n b: (1 ambda ( (ca)I Slide 12.4.10 The value of ca is just that procedure object, so we are going make-counter: to apply a procedure, and we know what rules to use Drop a b:(set! n ( n 1))n 6001 SICP Slide 12.4.11 Within that frame, bind the formal parameters of this procedure.(ca)I There aren,'t any, so there is nothing to put in the frame make-counter 1})n Slide 12.4.12 And relative to this new environment, evaluate the body of the make-counter: procedure, which says we are going to evaluate (set! n respect to E2. Notice the structure here. We now have a frame, E2, that points to a frame El, that points to the global environment set!n(+n1)|x2636.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 12.4.9 Here's a recap of the environment structure. We have the global environment with a binding for ca, which points to a procedure object whose environment pointer points to a new frame, or environment, E1. This frame is scoped by the global environment, but contains within it its own local variable n. Slide 12.4.10 The value of ca is just that procedure object, so we are going to apply a procedure, and we know what rules to use. Drop a frame. Slide 12.4.11 Within that frame, bind the formal parameters of this procedure. There aren't any, so there is nothing to put in the frame. Slide 12.4.12 And relative to this new environment, evaluate the body of the procedure, which says we are going to evaluate (set! n (+ n 1)) and then n, with respect to E2. Notice the structure here. We now have a frame, E2, that points to a frame E1, that points to the global environment
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有