How to Design Programs phần 6 doc
... important to document the problem generation with good examples and to give a good termination argument. Exercise 26. 3.5. Evaluate (quick-sort (list 10 6 8 9 14 12 3 11 14 16 2)) by hand. Show ... Figure 65 : The graph of some function To design a ``differentiator'' we must study how we could construct lines that have the same slope as a curve. In principle,...
Ngày tải lên: 12/08/2014, 19:20
... tree (ftn) (see section 14.1) and produces a list that explains how to get to a blue-eyed ancestor. If there is no blue-eyed ancestor, the function produces false. TEAMFLY ... figure 60 , people who know nothing about Scheme can now use our function, too. To build a graphical user interface, we build structures 49 that correspond to the GUI items and hand th...
Ngày tải lên: 12/08/2014, 19:20
... master-check uses. Let us now study how the design recipe applies to the development of the program. The first step is to define the state variables and to specify the purpose of each variable. ... draw-next-part to draw another part of the hangman figure. Of course, to accomplish this, hangman and check must have some memory about how often the ``Check'' bu...
Ngày tải lên: 12/08/2014, 19:20
How to Design Programs phần 9 doc
... individual traffic light. That is, in addition to switching from the current color to the next, an operator should be able to set a traffic light to red. The function for doing so already exists: ... effect: to change current-color from 'green to 'yellow, ;; 'yellow to 'red, and 'red to 'green (define (next) ) ;; next-color : TL-color -&...
Ngày tải lên: 12/08/2014, 19:20
How to Design Programs phần 1 pot
... that show the reader how to analyze a problem statement; how to formulate concise goals; how to make up examples; how to develop an outline of the solution, based on the analysis; how to finish ... marker refers to teacher hints, which suggest strategies on how to present a section, on how to approach an exercise, or on how to supplement some material. T...
Ngày tải lên: 12/08/2014, 19:20
How to Design Programs phần 2 pps
... Exercise 6. 1.1. Evaluate the following expressions: 1. (distance -to- 0 (make-posn 3 4)) 2. (distance -to- 0 (make-posn (* 2 3) (* 2 4))) 3. (distance -to- 0 (make-posn 12 (- 6 1))) by hand. Show ... need the two coordinates to compute the distance. Put differently, we know how to combine two numbers into a posn structure using make-posn and we don't know how...
Ngày tải lên: 12/08/2014, 19:20
How to Design Programs phần 3 pot
... In sections 6. 6 and 7.4, we studied how to move individual shapes. A picture, however, isn't just a single shape but a whole collection of them. Considering that we have to draw, translate, ... inventory management: the cost of an inventory. In addition to a list of the available toys, a store owner should also maintain a list of the cost of each item. The cost list permits...
Ngày tải lên: 12/08/2014, 19:20
How to Design Programs phần 4 ppt
... 16. 2.3. Show how to model a directory with two more attributes: a size and a systems attribute. The former measures how much space the directory itself (as opposed to its files and subdirectories) ... files and directories, they give us a good idea how such real-world programs work. Exercise 16. 3.1. Translate the file system in figure 44 into a Scheme representation. Remember...
Ngày tải lên: 12/08/2014, 19:20
How to Design Programs phần 7 ppt
... vectors. A vector is a well-defined mathematical class of data with specific basic operations. For our purposes, it suffices to know how to construct them, how to extract values, and how to ... counterexample. Consider the following table: plain factorial accumulator-style factorial 5. 760 5.970 5.780 5.940 5.800 5.980 5.820 5.970 5.870 6. 690 5.8 06 6.110 It repr...
Ngày tải lên: 12/08/2014, 19:20
How to Design Programs phần 10 potx
... -514- 76 The notation (vectorof X) is analogous to (listof X) . 77 Scheme proper provides list mutators, and a Scheme programmer would use them to represent a hand as ... TEAM FLY PRESENTS -5 26- index into the vector. Initially, the boundaries are 0 and (sub1 (vector-length V)) , which means that qsort-aux is to sort the entire vector. The definition of ... accumulat...
Ngày tải lên: 12/08/2014, 19:20