Loading... 中文叫函数式编程,乍一看这题直接懵逼了,函数作为变量代入另一个函数 直接看晕了,最后我理解的是,如果一个函数变量是另一个函数的话,那么这个函数就是高阶函数(<b>higher-order functions</b>) 实际上要传达的一个最重要的观念就是<strong>函数本身也可以作为变量被返回、传递给高阶函数</strong> <span style="font-family: 'arial black', sans-serif;">Functional programming is a style of programming that (as the name suggests) is based around functions.</span> <span style="font-family: 'arial black', sans-serif;">A key part of functional programming is <b>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.</b></span> [sourcecode language="python"] def test(func, arg): return func(func(arg)) def mult(x): return x * x print(test(mult, 2)) [/sourcecode] Last modification:September 12th, 2018 at 08:51 pm © 允许规范转载 Support 请博主喝一杯咖啡 ×Close Appreciate the author Sweeping payments Pay by AliPay Pay by WeChat