Mention "anonymous functions" and you just might bewilder a mathematician but a programmer will simply nod with understanding.
It turns out the concept itself is not unfamiliar to mathematicians, it's just they never bothered to christen the concept: anonymous functions are functions that are not bound to a name. (Can you say "Duh"?)
The function f(x) = 2x is not anonymous, its name is f(x); its anonymous version is y = 2x.
In Python a function is defined like so:
def f(x):
return 2*x
Anonymous functions are defined using the construct lambda:
g = lambda x : 2*x
And, oh, the irony, I assigned the name g to the anonymous function!





Anonymous Functions

Leave a Reply

Your email address will not be published. Required fields are marked *