Skip to content
Advertisement

Tag: tail-recursion

Haskell extremely slow simple recurrence

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

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

Advertisement