灯下 登录
计算机科学 / SICP / 2.1.3 What Is Meant by Data?

Exercise 2.5 · 习题

Exercise 2.5: Show that we can represent pairs of
nonnegative integers using only numbers and arithmetic operations if we
represent the pair a and b as the integer that is the product 2
a

3

b.

Give the corresponding definitions of the procedures cons,

car, and cdr.

练习 2.5:证明我们可以仅用数和算术运算表示非负整数的序对——将序对 a 与 b 表示为整数 2^a × 3^b。给出过程 cons、car 和 cdr 的相应定义。