练习3-67原文Exercise 3.67. Modify the pairs procedure so that (pairs integers integers) will produce the stream of all pairs of integers (i,j) (without the condition i < j). Hint: You will need to mix in...
分类:
其他好文 时间:
2015-03-29 10:55:03
阅读次数:
160
练习3-68原文Exercise 3.68. Louis Reasoner thinks that building a stream of pairs from three parts is unnecessarily complicated. Instead of separating the pair (S0,T0) from the rest of the pairs in the fir...
分类:
其他好文 时间:
2015-03-29 10:52:16
阅读次数:
136
练习3-69原文代码
(define (triples s t u)
(cons-stream (list
(stream-car s)
(stream-car t)
(stream-car u))
(interleave
(stream-map (lambda (x) (cons (stream-car s)...
分类:
其他好文 时间:
2015-03-29 10:50:16
阅读次数:
118
练习3-70原文代码(define (merge-weighted s1 s2 weight)
(cond ((stream-null? s1) s2)
((stream-null? s2) s1)
(else
(let ((cars1 (stream-car s1))
(cars2 (stream-car s2)))
(cond (...
分类:
其他好文 时间:
2015-03-29 10:50:12
阅读次数:
132
#lang racket(define tolerance 0.00001);公差(define (fixed-point f first-guess) (define (close-enough? v1 v2) (< (abs (- v1 v2)) tolerance) );clos...
分类:
其他好文 时间:
2015-03-29 10:40:43
阅读次数:
142
练习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 stream until it finds two successive elements that differ in...
分类:
其他好文 时间:
2015-03-29 09:31:45
阅读次数:
133
练习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 2, in the same way we did above for . How rapidly do the...
分类:
其他好文 时间:
2015-03-29 09:30:17
阅读次数:
165
练习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)))分析s是一串2的幂。也就是1、2、4、8、16、32……...
分类:
其他好文 时间:
2015-03-28 23:19:56
阅读次数:
396
练习3-59原文
代码a)(define (integrate-series s)
(stream-map * (stream-map / ones integers) s))b)(define sine-series (cons-stream 0 (integrate-series cosine-series)))
(define cosine-series (con...
分类:
其他好文 时间:
2015-03-28 23:19:21
阅读次数:
387
练习3-61原文
代码(define (reciprocal-series s)
(cons-stream 1 (scale-stream (mul-series (stream-cdr s)
(reciprocal-series s))...
分类:
其他好文 时间:
2015-03-28 23:17:09
阅读次数:
155