3 ms·
All of these versions are correct in theory, and the Go example in here is because Go is easily readable as a lingua franca. This whole post can be easily trans
by phoe-krk 9y ago
All of these versions are correct in theory, and the Go example in here is because Go is easily readable as a lingua franca. This whole post can be easily translated to other languages, including ones that do tail call optimization.
Also note that, despite Go having no TCO, the author has nonetheless managed to get a huge improvement over the naïve case by using proper tail recursion.