Function Comparison

Normal Python (Nested Def)

def myfunc(n):
    def multiplier(a):
        return a * n
    return multiplier

mydoubler = myfunc(2)
print(mydoubler(11)) # 22
        

Lambda Python (Shorthand)

myfunc = lambda n: lambda a: a * n



mydoubler = myfunc(2)
print(mydoubler(11)) # 22
        

The Lambda Calculus Logic

Both sides represent the mathematical term: λn.λa.an