Closed jahs closed 7 years ago
Hey @jahs, thanks for the the feature! This should make tail call recursion much more optimized.
Your code is failing to run against pypy3 (ref), though from the output it looks like tox might be having an issue setting up pypy3. I will look into it.
I use it mainly for functions that are naturally (non-tail) recursive - then a "naive" implementation is actually usable, avoiding the brain ache and lack of clarity of re-writing to continuation passing style. Yes it looked like a tox problem - thanks!
@jacobbridges pypy3 is no longer a problem since #27 See: #28
Hi I just fixed a edge-case bug. Is this good to go in? Thanks.
Hi is this going in? I've got another project which I'd like to make this a dependency of. Thanks.
Hi @jahs, I'm so sorry for the delay. We have recently moved so I've had little time to look at this.
I'll merge in the code, do some testing, then push out an updated version to pypi right away.
Very kind, thanks.
This has been merged and deployed to pypi.
Hi, this is a generalisation of recur.tco(). It can deal with recursive calls in a non-tail position, by implementing the recursive function as a generator and using generator.send() with a return stack in the trampoline. Thanks.