中文叫函数式编程,乍一看这题直接懵逼了,函数作为变量代入另一个函数
直接看晕了,最后我理解的是,如果一个函数变量是另一个函数的话,那么这个函数就是高阶函数(higher-order functions
实际上要传达的一个最重要的观念就是函数本身也可以作为变量被返回、传递给高阶函数

Functional programming is a style of programming that (as the name suggests) is based around functions.
A key part of functional programming is higher-order functions
We have seen this idea briefly in the previous lesson on functions as objects.
Higher-order functions take other functions as arguments, or return them as results.

[sourcecode language="python"]
def test(func, arg):
return func(func(arg))

def mult(x):
return x * x

print(test(mult, 2))
[/sourcecode]


如果支付遇到问题,请联系我们
Weixin1:Aburauru Weixin2:wanglanyy QQ:95387119
Last modification:September 12, 2018
如果觉得我的文章对你有用,请随意赞赏,点赞也是鼓励!