function object (functor) (2) : first-class funtion

http://en.wikipedia.org/wiki/First-class_function

 

In computer science, a programming language is said to support first-class functions[1] (also called function literalsfunction types) if it treats functions as first-class objects. Specifically, this means that the language supports

  • constructing new functions during the execution of a program
  • storing them in data structures
  • passing them as arguments to other functions
  • and returning them as the values of other functions.

Python

Python creates functions by the def statement or the lambda expression. Although lambda expressions cannot create functions that use statements in their definition as they are confined to be just expressions, they are flexible enough to show that they create first class functions as well as if the more powerful def statement were used

 

 

JavaScript

JavaScript supports both first class functions and lexical scope.

 

 

 

http://en.wikipedia.org/wiki/First-class_object

An object is first-class when it[citation needed]:

  • can be stored in variables and data structures
  • can be passed as a parameter to a subroutine
  • can be returned as the result of a subroutine
  • can be constructed at runtime
  • has intrinsic identity (independent of any given name)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

FireCoder

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值