内容 1.2 Procedures and the Processes They Generate · 26
练习 自检推理
Exercise 1.12: The following pattern of numbers
is called
Pascal’s triangle.
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
. . .
The numbers at the edge of the triangle are all 1, and each number inside the
triangle is the sum of the two numbers above it. Write a procedure that computes elements of Pascal’s triangle by
means of a recursive process.
练习 1.12:下面的数字排列称为帕斯卡三角形 (Pascal's triangle)。
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
. . .
三角形边缘的数全为 1,内部的每个数等于它正上方两个数之和。请写出一个用递归型计算过程计算帕斯卡三角形中各元素的过程。
SICP source code scheme
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
. . . 我的笔记 自动保存