3 ms·
With the python installed on my phone, the g(5) example does return the correct result 0, not 4 as the author of that blog post claims. So this kills one of his
by fhars 18y ago
With the python installed on my phone, the g(5) example does return the correct result 0, not 4 as the author of that blog post claims. So this kills one of his arguments againt tail call eliminaton.
From that example, I'm inclined to conclude that the author doesn't know much about either functional programming nor python. Given that I know who the author claims to be, I think I will just put python on my list of languages to be wary about.
And, by the way, Common Lisp does quite well treating TCO as an optional optimization.
- msie 18y agoI'm inclined to conclude that the author doesn't know much about either functional programming nor python I think he knows much about Python. Maybe not much about your "the python". :D
- fhars 18y agoMy "the python" is Python 2.2.2 on symbian_s60, which definitely doesn't show the buggy behaviour the author describes as the established semantics of python. And I started the next sentence with "Given that I know who the author claims to be" for a reason. Maybe I should have ended that sentence with a "¡", which according to wikipedia looks almost like the ethiopian sarcasm mark (if nobody mangles the encoding). (Sorry, no link, apple isn't the only phone manufacturer that can't implement cut and paste.)
- scott_s 18y agoIt's not a "bug" if the behavior is intended. I just tested the example with Version 2.5, and it returns 4. Version 2.2.2 is over six years old: http://www.python.org/download/releases/2.2.2/ http://www.python.org/download/releases/2.2.2/
- pauldino 18y agoFWIW, both Scheme and JavaScript have the same behavior as Python 2.5
- ghshephard 18y ago(Note - on HN it's considered polite to put additions to your original comment after an [edit] statement, or alternatively you can create a new reply)