Scheme guarantees TCO, but not Lisp in general I think. I seem to remember that Common Lisp does not guarantee TCO either.
Common Lisp does not guarantee it, but a few implementations do provide it
Re:Lisp.py
by capableweb on Wednesday July 20, 2022 @10:47AM
(#32166502)
One focuses on the learning aspects rather than creating a production lisp. If you want a production lisp, there are plenty out there.
And regardless, adding TCO is relatively simple as well, so not exactly a hard problem to figure out after you've written the first version of your toy lisp.
We're talking about Lisp in Python here. Python itself famously[1,2] refuses to have TCO.
1: http://neopythonic.blogspot.com/2009/04/tail-recursion-elimi... 2: http://neopythonic.blogspot.com/2009/04/final-words-on-tail-...
Re:Lisp.py
by capableweb on Wednesday July 20, 2022 @10:54AM
(#32166616)
Here is a lisp implementation (mal) with TCO, written in Python:
- https://github.com/kanaka/mal/blob/master/impls/python/step5...
- Theory: https://github.com/kanaka/mal/blob/master/process/guide.md#s...
Re:Lisp.py
by Xophmeister on Wednesday July 20, 2022 @05:05PM
(#32172318)
You can implement TCO in Python manually with continuation-passing style and trampolines.
Common Lisp doesn't guarantee TCO, and yet people manage just fine
(Yes, I know some do without, but usually not without a great reason...for example Clojure needing to maintain JVM calling conventions)