# 1.3用高阶函数表示抽象

> 译者： [https://sicp.comp.nus.edu.sg/chapters/18](https://sicp.comp.nus.edu.sg/chapters/18)



我们已经看到，函数实际上是抽象，它描述了独立于特定数字的数字复合操作。 例如，当我们声明

```js
function cube(x) {
    return x * x * x;
}
```

we are not talking about the cube of a particular number, but rather about a method for obtaining the cube of any number. Of course we could get along without ever declaring this function, by always writing expressions such as

```js
3 * 3 * 3;
x * x * x;
y * y * y;
```

and never mentioning `cube` explicitly. This would place us at a serious disadvantage, forcing us to work always at the level of the particular operations that happen to be primitives in the language (multiplication, in this case) rather than in terms of higher-level operations. Our programs would be able to compute cubes, but our language would lack the ability to express the concept of cubing. One of the things we should demand from a powerful programming language is the ability to build abstractions by assigning names to common patterns and then to work in terms of the abstractions directly. Functions provide this ability. This is why all but the most primitive programming languages include mechanisms for declaring functions.

但是，即使在数值处理中，如果我们限于参数必须为数字的函数，我们创建抽象的能力也会受到严重限制。 通常，相同的编程模式将用于许多不同的功能。 为了将这种模式表达为概念，我们将需要构造可以接受函数作为参数或返回函数作为值的函数。 操纵函数的函数称为_高阶函数_。 本节说明高阶函数如何充当强大的抽象机制，从而极大地提高了我们语言的表达能力。

