一级函数和高级函数之间的任何区别 [英] Any difference between First Class Function and High Order Function

查看:273
本文介绍了一级函数和高级函数之间的任何区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 First Class Function 高阶函数



我读完了这两个维基页面,他们看起来很相似。
如果他们谈论相同,为什么需要两个术语?



尝试谷歌,但没有发现任何有用的东西。

解决方案

有一个区别。当你说某种语言具有一流的功能时,这意味着语言将功能看作是值 - 你可以将一个功能分配给一个变量,将其传递给另一个变量等。高阶功能是对其他功能起作用的功能,意思是它们将一个或多个函数作为参数,并且还可以返回一个函数。

高阶概念一般可用于函数,如函数数学意义。 第一类概念只与编程语言的功能有关。在引用诸如一流功能之类的功能时很少使用它。 一种语言有/没有一流的功能支持更为常见。



这两件事情密切相关,因为很难想象带有不会支持高阶函数的第一类函数的语言,反之亦然是具有高阶函数但没有第一类函数支持的语言。

I'm wondering whether/what difference between First Class Function and High Order Function.

I read through those two wiki pages and they looks rather similar. If they talking about same, why need two terminologies?

Tried to google but have not found any useful thing.

解决方案

There is a difference. When you say that a language has first-class functions, it means that the language treats functions as values – that you can assign a function into a variable, pass it around etc. Higher-order functions are functions that work on other functions, meaning that they take one or more functions as an argument and can also return a function.

The "higher-order" concept can be applied to functions in general, like functions in the mathematical sense. The "first-class" concept only has to do with functions in programming languages. It’s seldom used when referring to a function, such as "a first-class function". It’s much more common to say that "a language has/hasn’t first-class function support".

The two things are closely related, as it’s hard to imagine a language with first-class functions that would not also support higher-order functions, and conversely a language with higher-order functions but without first-class function support.

这篇关于一级函数和高级函数之间的任何区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆