内容 3.5 Streams · 266
练习 自检推理
Exercise 3.54: Define a procedure
mul-streams, analogous to add-streams, that produces the
elementwise product of its two input streams. Use this together with the
stream of integers to complete the following definition of the stream
whose n
th element (counting from 0) is n
+
1 factorial:
(define factorials
(cons-stream 1 (mul-streams ⟨??⟩ ⟨??⟩)))
练习 3.54:定义一个过程 mul-streams,类似于 add-streams,它产生两个输入流的逐元素之积。用它与整数流一起,补全以下定义——该流的第 n 个元素(从 0 开始计数)为 n + 1 的阶乘:
(define factorials
(cons-stream 1 (mul-streams ⟨??⟩ ⟨??⟩)))
SICP source code scheme
(define factorials
(cons-stream 1 (mul-streams ⟨??⟩ ⟨??⟩))) 我的笔记 自动保存