For instance, this is my factorial function:
def fact(n):
if n<=1: return 1
else: return n*fact(n-1)
But it crashes when n is too high. I'd like to emulate this exact same function using a stack emulation. How would I do something like this? What if it's not tail-recursive? Having a hard time finding explanations.