Вопрос

I saw two concepts

It seems that these two concepts are the same? (lambda)

I'm confused?

Это было полезно?

Решение

A first class function is one which is reified - i.e. it can be manipulated as part of the language, can be passed to other functions, be the value of a variable.

An anonymous function is just one which does not have a name (or does not have a "function" name, if functions and variables occupy separate namespaces).

It would be moderately difficult to design a language with anonymous, non-first-class functions, but the two concepts are sufficiently distinct that you at least kinda-sorta could. Equally, you definitely could have a language with first class functions, but no anonymous functions. These languages are rare, because there's little point in such a design.

Другие советы

Marcin has the right answer. To give some examples: C and C# 1.0 both have first-class functions, but do not have anonymous functions. In both cases, you can only explicitly declare named functions, but once you have, you can get references to them and store them in variables.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top