灯下 登录
计算机科学 / SICP / 3.5.2 Infinite Streams

Exercise 3.55 · 习题

Exercise 3.55: Define a procedure
partial-sums that takes as argument a stream S and returns the
stream whose elements are S
0, S
0

+

S
1, S
0

+

S
1

+

S
2

,

….

For example, (partial-sums integers) should be the

stream 1, 3, 6, 10, 15, ….

练习 3.55:定义一个过程 partial-sums,它以流 S 为参数,返回一个流,其各元素为 S₀,S₀ + S₁,S₀ + S₁ + S₂,……。例如,(partial-sums integers) 应得到流 1, 3, 6, 10, 15, ……。