3 ms·
So do the tail recursion in C. Any decent compiler will handle it just fine. If you want to include crappy compilers, well, then we need to include the same fo
by burfog 8y ago
So do the tail recursion in C.
Any decent compiler will handle it just fine. If you want to include crappy compilers, well, then we need to include the same for LISP and Scheme. Whatever the language specification may claim about tail recursion is not relevant when you sit down to produce code for the actual system at hand.
- kazinator 8y agoA Scheme compiler that doesn't do tail recursion isn't crappy; it is incorrect/nonconforming. A C compiler that doesn't do tail recursion still conforms to the abstract language semantics. In Scheme, local functions are used for looping (via tail recursion). C doesn't even have those (other than as a GNU C extension).
- noelwelsh 8y agoThis isn't a C vs Scheme (or whatever) discussion. It's about the utility of (tail) recursion vs iterative constructs. That C compilers may optimise tail recursion isn't relevant.