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 actual syntax of anonymous functions depends on the programming language being used: Smells of ConfusedComputerScience. 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.
Kid: Mom, when I grow up can I finally get a name, like dad did when he became an object?

Mom: I'm not sure you want to be big and bloated like him, son. Careful what you ask for.

This is funny, but seems to be missing a point and doesn't appear to be related to the above.
See also LambdaExpression

EditText of this page (last edited May 21, 2013) or FindPage with title or text search