【SICP练习题】129 练习3.60
【SICP练习】129 练习3.60
练习3-60
原文
Exercise 3.60. With power series represented as streams of coefficients as in exercise 3.59, adding series is implemented by add-streams. Complete the definition of the following procedure for multiplying series:
(define (mul-series s1 s2)
(cons-stream <??> (add-streams <??> <??>)))
You can test your procedure by verifying that sin2 x + cos2 x = 1, using the series from exercise 3.59.
代码
(define (mul-series s1 s2)
(cons-stream (* (stream-car s1)
(stream-car s2))
(add-streams (mul-streams (stream-cdr s1)
(stream-cdr s2))
(mul-series s1 s2))))