在函数式编程中，函数构成了计算的构建块(In functional programming, functions constitute the building blocks of computing)
函数式编程是一种编程范式，它规定了一种不同的算法方式来思考问题并为其编程解决方案。将其与面向对象编程进行对比，在 OOP 中，主要抽象是类/对象，而在函数式编程中，主要抽象是函数。在 OOP 中，对象构成了计算的构建块。同样，在函数式编程中，函数构成了计算的构建块。
Functional programming is a programming paradigm, which stipulates a different algorithmic way to think about problems and program solutions for them. Compared with object-oriented programming, in OOP, the main abstraction is class / object, while in functional programming, the main abstraction is function. In OOP, objects constitute the building blocks of calculation. Similarly, in functional programming, functions constitute the building blocks of calculation.
< strong > functional programming imposes a declarative programming style < / strong >, that is, we program through expressions or declarations (calculations are expressed in the form of functions / expressions – black boxes)< Strong > declarative programming style is about defining what to do, not how to do it < / strong >, which is compared with imperative programming, which is about defining what to do and how to do it. Simply put, in declarative programming, it is to have an abstraction layer to produce expressive code. Functional programming is often declarative, and declarative thinking and coding often produce better, readable and expressive code. An example of declarative and imperative styles is:
Functional programming puts the combined expression of function and function in the first place.