Version 0 of first-class functions

Updated 2011-05-21 13:41:49 by aspect

A concept that exists in functional and semi-functional languages including Scheme, Javascript, Haskell, ML ... and is introduced partially to Tcl with lambdas for apply.

The principle is that functions are "first class citizens", like numbers, strings or any other value. Thus, they can be:

  • stored in variables
  • passed to functions
  • returned from functions

like any other value. Note that functions are usually opaque objects, so introspection is not available.

First-class functions permit coding styles that are not available in languages without them (C is a good example):