I’m experimenting with Haskell profiling with a simple recursive max algorithm: When I compare it to a python imperative equivalent, I get a 10x speed factor in favor of python: It seems there is an inherent limitation of using tail recursion in the Haskell case, am I right? Any other way to make the Haskell code faster? The input file
Tag: tail-recursion
Call a Recursive method inside a class
I am trying to use tail recursion here, and I am getting Error: name ‘tribonacci’ is not defined Answer Use self keyword and also I have solved one logical error
Does Python optimize tail recursion?
I have the following piece of code which fails with the following error: RuntimeError: maximum recursion depth exceeded I attempted to rewrite this to allow for tail recursion optimization (TCO). I believe that this code should have been successful if a TCO had taken place. Should I conclude that Python does not do any type of TCO, or do I
Explain to me what the big deal with tail-call optimization is and why Python needs it
Apparently, there’s been a big brouhaha over whether or not Python needs tail-call optimization (TCO). This came to a head when someone shipped Guido a copy of SICP, because he didn’t “get it.” I’m in the same boat as Guido. I understand the concept of tail-call optimization. I just can’t think of any reason why Python really needs it. To