Jump to content

Anonymous function

From Simple English Wikipedia, the free encyclopedia
Revision as of 02:03, 11 November 2011 by PiRSquared17 (talk | changes) (forgot my LaTeX there)

In computer science and mathematics, an anonymous function is a function that has no name. Usually, a function is written like: . It can be written anonymously as These are used in function programming languages and other programming languages with support for anonymous functions (those which support 1st class functions).

Example in Python

(lambda x: (lambda y: x * y))

The above code can be executed as a function:

>>>(lambda x: (lambda y: x * y))(3)(4)
12