自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(65)
  • 收藏
  • 关注

sicp 2.53

Exercise 2.53.  What would the interpreter print in response to evaluating each of the following expressions?  (list 'a 'b 'c)(list (list 'george))(cdr '((x1 x2) (y1 y2)))(cadr '((x1 x2) (y1 y2...

2013-09-13 11:22:25 84

sicp 2.50

Exercise 2.50.  Define the transformation flip-horiz, which flips painters horizontally, and transformations that rotate painters counterclockwise by 180 degrees and 270 degrees. (define (flip-...

2011-12-06 15:33:53 86

sicp 2.49

Exercise 2.49.  Use segments->painter to define the following primitive painters:a.  The painter that draws the outline of the designated frame.b.  The painter that draws an ``X'' by connect...

2011-12-06 15:25:37 89

sicp 2.48

Exercise 2.48.  A directed line segment in the plane can be represented as a pair of vectors -- the vector running from the origin to the start-point of the segment, and the vector running from the or...

2011-11-28 18:07:08 85

sicp 2.47

 Exercise 2.47.  Here are two possible constructors for frames: (define (make-frame origin edge1 edge2)  (list origin edge1 edge2))(define (make-frame origin edge1 edge2)  (cons origin (cons edg...

2011-11-28 18:02:46 71

sicp 2.46

Exercise 2.46.  A two-dimensional vector v running from the origin to a point can be represented as a pair consisting of an x-coordinate and a y-coordinate. Implement a data abstraction for vectors...

2011-11-28 17:53:58 76

sicp 2.45

 Exercise 2.45.  Right-split and up-split can be expressed as instances of a general splitting operation. Define a procedure splitwith the property that evaluating (define right-split (split bes...

2011-11-28 17:47:31 80

sicp 2.44

Exercise 2.44.  Define the procedure up-split used by corner-split. It is similar to right-split, except that it switches the roles ofbelow and beside. 参考right-split,比较简单:  (define (up-split...

2011-11-28 17:08:24 91

sicp 2.43

Exercise 2.43.  Louis Reasoner is having a terrible time doing exercise 2.42. His queens procedure seems to work, but it runs extremely slowly. (Louis never does manage to wait long enough for it t...

2011-11-25 14:08:09 98

sicp 2.42

Exercise 2.42.   Figure 2.8:  A solution to the eight-queens puzzle. The ``eight-queens puzzle'' asks how to place eight queens on a chessboard so that no queen is in check...

2011-11-25 13:06:01 144

sicp 2.41

Exercise 2.41.  Write a procedure to find all ordered triples of distinct positive integers i, j, and k less than or equal to a given integer n that sum to a given integer s.  (define (find-t...

2011-11-21 16:58:17 79

sicp 2.39

 Exercise 2.39.   Complete the following definitions of reverse (exercise 2.18) in terms of fold-right and fold-left from exercise 2.38: (define (reverse sequence)  (fold-right (lambda (x y) &lt...

2011-11-18 01:42:18 67

sicp 2.26

 Exercise 2.36.  The procedure accumulate-n is similar to accumulate except that it takes as its third argument a sequence of sequences, which are all assumed to have the same number of elements. It...

2011-11-17 17:39:28 90

sicp 2.35

Exercise 2.35.  Redefine count-leaves from section 2.2.2 as an accumulation: (define (count-leaves t)  (accumulate <??> <??> (map <??> <??>)))  (define (accum...

2011-11-17 17:17:46 104

sicp 2.33

Exercise 2.33.  Fill in the missing expressions to complete the following definitions of some basic list-manipulation operations as accumulations: (define (map p sequence)  (accumulate (lambda ...

2011-11-16 15:51:24 66

sicp 2.32

Exercise 2.32.  We can represent a set as a list of distinct elements, and we can represent the set of all subsets of the set as a list of lists. For example, if the set is (1 2 3), then the set of...

2011-11-16 15:06:43 106

sicp 2.29

 Exercise 2.29.  A binary mobile consists of two branches, a left branch and a right branch. Each branch is a rod of a certain length, from which hangs either a weight or another binary mobile. We c...

2011-11-16 13:51:33 102

sicp 2.28

Exercise 2.28.  Write a procedure fringe that takes as argument a tree (represented as a list) and returns a list whose elements are all the leaves of the tree arranged in left-to-right order. For ...

2011-07-25 15:00:14 106

sicp 2.27

Exercise 2.27.  Modify your reverse procedure of exercise 2.18 to produce a deep-reverse procedure that takes a list as argument and returns as its value the list with its elements reversed and with a...

2011-07-25 14:46:50 107

sicp 2.26

Exercise 2.26.  Suppose we define x and y to be two lists:  (define x (list 1 2 3))(define y (list 4 5 6)) What result is printed by the interpreter in response to evaluating each of the ...

2011-07-25 14:38:24 72

sicp 2.25

Exercise 2.25.  Give combinations of cars and cdrs that will pick 7 from each of the following lists:  (1 3 (5 7) 9)((7))(1 (2 (3 (4 (5 (6 7))))))  (define a '(1 3 (5 7) 9))(defi...

2011-07-25 14:35:42 72

sicp 2.19

Exercise 2.19.  Consider the change-counting program of section 1.2.2. It would be nice to be able to easily change the currency used by the program, so that we could compute the number of ways to ...

2011-07-24 00:19:01 71

sicp 2.18

 Exercise 2.18.  Define a procedure reverse that takes a list as argument and returns a list of the same elements in reverse order:  (reverse (list 1 4 9 16 25))(25 16 9 4 1)    (def...

2011-07-21 23:48:23 94

sicp 2.17

Exercise 2.17.  Define a procedure last-pair that returns the list that contains only the last element of a given (nonempty) list:  (last-pair (list 23 72 149 34))(34)  (define (la...

2011-07-21 23:42:13 61

sicp 2.16

Exercise 2.16.  Explain, in general, why equivalent algebraic expressions may lead to different answers. Can you devise an interval-arithmetic package that does not have this shortcoming, or is thi...

2011-07-21 23:27:24 102

sicp 2.15

Exercise 2.15.  Eva Lu Ator, another user, has also noticed the different intervals computed by different but algebraically equivalent expressions. She says that a formula to compute with intervals us...

2011-07-21 23:17:31 93

sicp 2.14

Exercise 2.14.  Demonstrate that Lem is right. Investigate the behavior of the system on a variety of arithmetic expressions. Make some intervals Aand B, and use them in computing the expressions A/A ...

2011-07-21 23:16:14 112

sicp 2.13

Exercise 2.13.  Show that under the assumption of small percentage tolerances there is a simple formula for the approximate percentage tolerance of the product of two intervals in terms of the toleran...

2011-07-20 10:06:25 86

sicp 2.12

Exercise 2.12.  Define a constructor make-center-percent that takes a center and a percentage tolerance and produces the desired interval. You must also define a selector percent that produces the per...

2011-07-19 19:44:17 81

sicp 2.11

Exercise 2.11.  In passing, Ben also cryptically comments: ``By testing the signs of the endpoints of the intervals, it is possible to break mul-interval into nine cases, only one of which requires mo...

2011-07-19 19:30:40 110

sicp 2.10

Exercise 2.10.  Ben Bitdiddle, an expert systems programmer, looks over Alyssa's shoulder and comments that it is not clear what it means to divide by an interval that spans zero. Modify Alyssa's code...

2011-07-19 18:24:35 85

sicp 2.9

Exercise 2.9.  The width of an interval is half of the difference between its upper and lower bounds. The width is a measure of the uncertainty of the number specified by the interval. For some arithm...

2011-07-19 18:16:28 68

sicp 2.8

Exercise 2.8.  Using reasoning analogous to Alyssa's, describe how the difference of two intervals may be computed. Define a corresponding subtraction procedure, called sub-interval.   (def...

2011-07-19 13:49:02 76

sicp 2.7

Exercise 2.7.  Alyssa's program is incomplete because she has not specified the implementation of the interval abstraction. Here is a definition of the interval constructor:  (define (make-in...

2011-07-19 13:44:40 98

sicp 2.5

Exercise 2.5.  Show that we can represent pairs of nonnegative integers using only numbers and arithmetic operations if we represent the pair a and b as the integer that is the product 2a 3b. Give the...

2011-07-14 16:42:46 96

sicp 2.4

Exercise 2.4.  Here is an alternative procedural representation of pairs. For this representation, verify that (car (cons x y))yields x for any objects x and y.  (define (cons x y)  (lambda (...

2011-07-14 16:02:04 58

sicp 2.3

Exercise 2.3.  Implement a representation for rectangles in a plane. (Hint: You may want to make use of exercise 2.2.) In terms of your constructors and selectors, create procedures that compute t...

2011-07-12 22:05:32 62

原创 sicp 2.2

 Exercise 2.2.  Consider the problem of representing line segments in a plane. Each segment is represented as a pair of points: a starting point and an ending point. Define a constructor make-...

2011-07-12 21:16:57 63

原创 sicp 2.1

Exercise 2.1.  Define a better version of make-rat that handles both positive and negative arguments. Make-rat should normalize the sign so that if the rational number is positive, both the numera...

2011-07-12 21:00:53 67

原创 sicp 1.41

Exercise 1.41.  Define a procedure double that takes a procedure of one argument as argument and returns a procedure that applies the original procedure twice. For example, if inc is a procedure...

2011-07-10 23:56:28 151

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除