Anonymous Function

In a programming language, an unnamed function object (also: "function literal").

Example (in PseudoCode):

"lambda(x,y){ x>y }" is an anonymous function object representing the function that tells whether its first argument is greater than its second argument.

This lets you write (e.g.)

  sort(lambda(x,y){ x>y }, [5,7,3,4,9,5,4])
instead of

  def compfunc(x,y) {

Analogously, "42" is an anonymous number object (or "number literal") representing the number 42, which lets you write (e.g.)

instead of

  def value := 42
(for the last code snippet, imagine that this was written in a programming language that does not let you use numbers directly, but always requires you to give them a name first using "def <name> := <value>")

The syntax of anonymous functions depends on the programming language being used: Shouldn't this be simply called an unnamed function? -- MarkJanssen

Sometimes it is. In every technical field, science or craft, some things get multiple names.

See also LambdaExpression

View edit of September 13, 2014 or FindPage with title or text search