Any difference between First Class Function and High Order Function Ask Question

Any difference between First Class Function and High Order Function Ask Question

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.

ベストアンサー1

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”.

これら 2 つは密接に関連しており、第一級関数を持ちながら高階関数もサポートしない言語や、逆に高階関数を持ちながら第一級関数をサポートしない言語を想像するのは難しいです。

おすすめ記事