内容 1.3 Formulating Abstractions with Higher-Order Procedures · 65
练习 自检推理
Exercise 1.42: Let f and g be two
one-argument functions. The
composition f after g is defined
to be the function x
↦
f
(
g
(
x
)
). Define a procedure
compose that implements composition. For example, if inc is a
procedure that adds 1 to its argument,
((compose square inc) 6)
49
练习 1.42:设 f 和 g 是两个单参数函数。f 在 g 之后的复合 (composition) 定义为函数 x ↦ f(g(x))。定义过程 compose 来实现复合。例如,若 inc 是一个给参数加 1 的过程,则
((compose square inc) 6)
49
SICP source code scheme
((compose square inc) 6)
49 我的笔记 自动保存