3 ms·
I believe the following is a corecursive analog for a stack recursive factorial implementation in Python: def factorial(i = 1): yield i for
by Sharlin 13y ago
I believe the following is a corecursive analog for a stack recursive factorial implementation in Python:
def factorial(i = 1):
yield i
for j in factorial(i + 1):
yield j*i
Not sure why anyone would want to implement it like that, though.
- deleted 13y ago[deleted]