正在加载图片...
6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology Slide 7.3.1 Here is the bug. We started with the wrong initial value-a common error. By fixing this, we can try again and (define(aux x n current addit) display nya display" current⊥8") let ((next (/(expt x n)(fact n)))) E《8a11-enuf?next (aux x ( n 2) ( current ( addit next))(* addit -1))))) aux x 0 1 6 001 SICP t214 Slide 7.3.13 finally we get correct performance. Note how we have used (sne《/3.14159272.0) printing of values to isolate changes, as well as using the debugger to find syntax errors ix eurrent ia1.D04524日5599日199 (cinn3.1415927) n ix 3 urrent ig 3, 1415927 17m:1313为1 n11l时1:32 5418112354e-3 va1ue:-4.452067333052500e-4 rsle ommt is. 601h Slide 7.3.14 Summary In general, we want you to get into the habit of doing the same things. Developing good programming methodology habits now will greatly help you when you have to deal with larg Test cases to highlight errors complex, bodies of code. Good programming discipline means Check range of test cases being careful and thorough in the creation and refinement of Use these tricks and tools! code of all sizes and forms, so start exercising your programming muscles""now! 4 6 001 SICP 6.001 Notes: Section 7.46.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 7.3.12 Here is the bug. We started with the wrong initial value – a common error. By fixing this, we can try again and … Slide 7.3.13 … finally we get correct performance. Note how we have used printing of values to isolate changes, as well as using the debugger to find syntax errors. Slide 7.3.14 In general, we want you to get into the habit of doing the same things. Developing good programming methodology habits now will greatly help you when you have to deal with large, complex, bodies of code. Good programming discipline means being careful and thorough in the creation and refinement of code of all sizes and forms, so start exercising your “programming muscles” now! 6.001 Notes: Section 7.4
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有