码迷,mamicode.com
首页 > 其他好文 > 详细

first-class function & Higher-order function

时间:2018-08-22 11:07:58      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:sim   eva   with   least   lang   from   like   ret   lua   

first-class function 头等函数

A first-class function is not a particular kind of function. All functions in Python are first-class functions. To say that functions are first-class in a certain programming language means that they can be passed around and manipulated similarly to how you would pass around and manipulate other kinds of objects (like integers or strings). You can assign a function to a variable, pass it as an argument to another function, etc. The distinction is not that individual functions can be first class or not, but that entire languages may treat functions as first-class objects, or may not.

Higher-order function 高阶函数

In mathematics and computerscience, a higher-order function (also functionalfunctional form or functor) is a function that does at least one of the following:

  • takes one or more functions as arguments (i.e. proceduralparameters),
  • returns a function as its result.

Currying 柯里化 

currying is the technique of translating the evaluation of a function that takes multiple arguments into evaluating a sequence of functions, each with a single argument. For example, a function that takes two arguments, one from X and one from Y, and produces outputs in Z, by currying is translated into a function that takes a single argument from X and produces as outputs functions from Y to Z.Currying is related to, but not the same as, partialapplication.

first-class function & Higher-order function

标签:sim   eva   with   least   lang   from   like   ret   lua   

原文地址:https://www.cnblogs.com/gm-201705/p/9516156.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!