>>>>> "Pit" == Pit Capitain <pit / capitain.de> writes:
Pit> Hi Jim,
Pit> the Y combinator was fun, indeed.
Pit> Here is a two-argument version, as proposed by pixel in
Pit> http://lambda.weblogs.com/discuss/msgReader$838#842
Pit> p proc { |f,x| f[f,x] } [ proc { |f,n| n>1 ? n * f[f,n-1] : 1 }, 5 ]
Pit> Your's is more readable, though :)
I don't know if I would call either of them *readable*. :-)
My one-argument version does come from Friedman's "The Little
Schemer". SICP also gives a (slightly different) one-argument
version.
For more fun, check out the Java and Perl versions ...
http://www.clug.org//ml/archive/programming/1998-11/msg00014.html
http://www.clug.org//ml/archive/programming/1998-11/msg00003.html
--
-- Jim Weirich jweirich / one.net http://w3.one.net/~jweirich
---------------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)