First class function

from Wikipedia, the free encyclopedia

A first-class function ( English first-class function , German about "first class function") describes a function in programming that

  • passed to another function as an argument,
  • returned as a value by another function,
  • assigned to a variable,
  • stored in a data structure and
  • generated at runtime

can be. In some cases, the option of defining anonymous functions also applies as a criterion for a first-class function.

Only then is it possible to create closures , define anonymous functions or carry out currying .

The term was coined by Christopher Strachey in the context of functions as first-class citizens in the mid-1960s.

In many modern programming languages ​​(such as Haskell , JavaScript , Smalltalk and especially various Lisp dialects such as Scheme ) all functions are first-class. The educational visual programming language Snap! Offers a very easy to understand approach to this concept for beginners . (BYOB) .

See also

swell

  1. ^ Rod Burstall: Christopher Strachey — Understanding Programming Languages . In: Higher-Order and Symbolic Computation . tape 13 , no. 1-2 . Kluwer academic publishers, 2000, ISSN  1388-3690 , p. 52 , doi : 10.1023 / A: 1010052305354 (English).