摘要: 练习3-65原文Exercise 3.65. Use the series ln2 = 1- 1/2 + 1/3 - 1/4 + …… to compute three sequences of approximations to the natural logarithm of... 阅读全文
posted @ 2015-03-28 23:58 nomasp 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 练习3-64原文Exercise 3.64. Write a procedure stream-limit that takes as arguments a stream and a number (the tolerance). It should examine the st... 阅读全文
posted @ 2015-03-28 23:52 nomasp 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 练习3-63原文Exercise 3.63. Louis Reasoner asks why the sqrt-stream procedure was not written in the following more straightforward way, without t... 阅读全文
posted @ 2015-03-28 23:28 nomasp 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 练习3-62原文Exercise 3.62. Use the results of exercises 3.60 and 3.61 to define a procedure div-series that divides two power series. Div-series ... 阅读全文
posted @ 2015-03-28 22:59 nomasp 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 练习3-61原文 代码(define (reciprocal-series s) (cons-stream 1 (scale-stream (mul-series (stream-cdr s) ... 阅读全文
posted @ 2015-03-28 22:58 nomasp 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 练习3-60原文Exercise 3.60. With power series represented as streams of coefficients as in exercise 3.59, adding series is implemented by add-stre... 阅读全文
posted @ 2015-03-28 22:52 nomasp 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 练习3-59原文 代码a)(define (integrate-series s) (stream-map * (stream-map / ones integers) s))b)(define sine-series (cons-stream 0 (int... 阅读全文
posted @ 2015-03-28 22:48 nomasp 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 练习3-58原文Exercise 3.58. Give an interpretation of the stream computed by the following procedure:(define (expand num den radix) (cons-str... 阅读全文
posted @ 2015-03-28 22:38 nomasp 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 练习3-57原文Exercise 3.57. How many additions are performed when we compute the nth Fibonacci number using the definition of fibs based on the ad... 阅读全文
posted @ 2015-03-28 22:28 nomasp 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 练习3-56原文Exercise 3.56. A famous problem, first raised by R. Hamming, is to enumerate, in ascending order with no repetitions, all positive in... 阅读全文
posted @ 2015-03-28 22:18 nomasp 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 练习3-55原文Exercise 3.55. Define a procedure partial-sums that takes as argument a stream S and returns the stream whose elements are S0, S0 + S... 阅读全文
posted @ 2015-03-28 22:11 nomasp 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 练习3-54原文Exercise 3.54. Define a procedure mul-streams, analogous to add-streams, that produces the elementwise product of its two input strea... 阅读全文
posted @ 2015-03-28 22:09 nomasp 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 练习3-53原文Exercise 3.53. Without running the program, describe the elements of the stream defined by (define s (cons-stream 1 (add-streams s s)... 阅读全文
posted @ 2015-03-28 22:05 nomasp 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 练习3-52原文Exercise 3.52. Consider the sequence of expressions(define sum 0) (define (accum x) (set! sum (+ x sum)) sum) (define seq (strea... 阅读全文
posted @ 2015-03-28 21:55 nomasp 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 练习3-51原文Exercise 3.51. In order to take a closer look at delayed evaluation, we will use the following procedure, which simply returns its ar... 阅读全文
posted @ 2015-03-28 21:50 nomasp 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 练习3-50原文Exercise 3.50. Complete the following definition, which generalizes stream-map to allow procedures that take multiple arguments, anal... 阅读全文
posted @ 2015-03-28 21:44 nomasp 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 虽说叫做副作用显得不太好听,但在Lisp中副作用还是非常重要的。而相对于所有状态都必须显式地操作和传递额外参数的方式,如果引进赋值和将状态隐藏在局部变量中,那么就可以用更加模块化的方式来构造系统。正如你所知道的,不用任何赋值的程序设计称为函数式程序设计。相反,广泛采用赋值的程序设计称... 阅读全文
posted @ 2015-03-28 10:38 nomasp 阅读(184) 评论(0) 推荐(0) 编辑