正在加载图片...
6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology Slide 12.3.33 Step three: create a binding, that is, take the formal parameter Example contd:(square y)I of the procedure, x, and bind it in that frame to the value tnc-square passed in, 4 (square y)) square e=> #[compound] y n==>4 0:31 EXample cont'd: (square y)E Slide 12.3.34 And step four: with respect to that new environment, evaluate squasquare: the body of this procedure, (* xx). So we have reduced this evaluation to multiplying x by itself within environment E2 x:4 P: Y b:(*xx)b:(+1 6001 sCP Slide 12.3.35 Example contd: (square y)Ie So now we are almost done. The values of each of these subexpression with respect to E2 are obtained by applying the Ge-ine-ggu name rule, starting in the first frame of E2. We then apply the primitive multiplication procedure to the value of 4 and 4 1 square nI => #[compound] y KI == 4 |n2==>#【prim]6m=>4 Example contd: (square y)Ig Slide 12.3.36 That of course just returns 16 (square y)) square n1 =>#[compound] yg==> 4 I E2 == #[prim 46.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 12.3.33 Step three: create a binding, that is, take the formal parameter of the procedure, x, and bind it in that frame to the value passed in, 4. Slide 12.3.34 And step four: with respect to that new environment, evaluate the body of this procedure, (* x x). So we have reduced this evaluation to multiplying x by itself within environment E2. Slide 12.3.35 So now we are almost done. The values of each of these subexpression with respect to E2 are obtained by applying the name rule, starting in the first frame of E2. We then apply the primitive multiplication procedure to the value of 4 and 4. Slide 12.3.36 That of course just returns 16
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有