News for hackers. Stuff that matters.
Re:Fixed-Point Combinator by gregfjohnson on Saturday February 24, 2024 @02:17AM (#39489790)
One additional comment, regarding the "fac1" functional above:

  >>> fac1 = lambda f: lambda n: ((n > 1) and n * f(n-1) or 1)
If you happened to have a function "my_fac" that calculates the factorial function, and you applied "fac1" above to that function, you would get a new implementation of the factorial function, that calls your my_fac function internally. In other words, "my_fac" is a fixed point of fac1:

  >>> fac1(my_fac)
is the same function as my_fac.

There are no comments on this comment yet.