Steven D'Aprano wrote: > On Sat, 28 Jan 2006 00:13:28 -0800, Kay Schluehr wrote: > > [snip lambda calculus stuff] > > > In Python you can write: > > > > Y = lambda g: (lambda f: g(lambda arg: f(f)(arg))) (lambda f: g(lambda > > arg: f(f)(arg))) > > > > This serves the purpose. Try Y(F) and see. > > > Is any of this stuff maintainable in the real world of IT, where > most programmers don't have computer science degrees?
Probably not. But the good thing about Y is that it is in closed form and the expression is not infinitely long. By the way I have no less a hard time to read C code with advanced data-structures and many type casts which is much more likely to happen in the "real world". >From what I've seen the only *practical* purpose fixpoint combinators serve is a kind of recursion "overloading". Without modifying F one can memoize values by adapting the fixpoint combinator. We already know something similar from the Go4 "command pattern" but there is no self-referential entanglement and it is less general. > You come along six > months after the project was finished to maintain this code and discover > that the whiz-kid lambda calculus guy never commented anything because > that would detract from the elegance of his one liners; what happens next? Ask a Scheme guy at LtU. Accuse the original author in Den Haag and if caught put him to shame by making photos at a dentist. Google for "lambda calculus Y". Ask someone here at comp.lang.python. Ask your boss for more time ;) Kay -- http://mail.python.org/mailman/listinfo/python-list