Recursive Lambda Calculus


>>> f = lambda b = None, a = 0: a if b is None else lambda c = None: f(c, a + b)


This recursive lambda function is a solution to a challenge posed to me by a mate on irc.
The function can accept an infinite number of numbers in this weird style, and recursively sum them. Pretty mind boggling and cool if you ask me! Recursive lambdas take some good time to get your head around but you can achieve some weird things with them.


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