3 ms·
> "How is this read: \lambda x.\, x - 3" I'd read it as "Lambda x maps to x - 3." In Python, you can rewrite lambdas as regular functions if you want. la
by omegaham 8y ago
> "How is this read: \lambda x.\, x - 3"
I'd read it as "Lambda x maps to x - 3."
In Python, you can rewrite lambdas as regular functions if you want.
lambda x : x - 3
is the same as
def f(x):
return x - 3
This runs in the IDLE as such:
>>> f = lambda x : x - 3
>>> def g(x):
... return x - 3
...
>>> f(0)
-3
>>> g(0)
-3
>>> (lambda x : x - 3)(0)
-3