Content deleted Content added
WP |
Add "Simpler solution" section |
||
Line 67:
I’ve accordingly expanded this page into a proper article – hope it looks good, and please improve it!
:—Nils von Barth ([[User:Nbarth|nbarth]]) ([[User talk:Nbarth|talk]]) 06:02, 27 April 2013 (UTC)
== Simpler solution ==
I came up with a simpler lambda calculus solution for recursion. All I did was take the anonymous recursion version, and replace "lambda a, b" with "lambda a: lambda b:", and "(a, b)" with "(a)(b)".
<source lang=python>
(lambda f: lambda x: f(f)(x)) \
(lambda f: lambda x: 1 if x == 0 else x * f(f)(x-1))
</source>
But, this is original research I guess, so I won't put it on the page. Also the existing explanation might help people trying to understand the Y combinator.
|