Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A useful term when understanding tail recursion is "trampoline"[1], even though most compilers don't use this, it is a very useful way of visualising tail recursive calls.

[1] - https://en.wikipedia.org/wiki/Tail_call#Through_trampolining



If anybody is interested in trampolines, I just wrote an introduction to them that uses Python examples and includes a runtime visualization so you can see what's happening with the stack:

http://blog.moertel.com/posts/2013-06-12-recursion-to-iterat...


You can trampoline in JavaScript too. I showed how the performance may not be as you expect: http://taylodl.wordpress.com/2013/06/07/functional-javascrip...


Great read so far.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: