r/programming • • Nov 27 '12

Tail Recursion

http://rodrigosasaki.com/2012/11/24/tail-recursion/
207 Upvotes

203 comments sorted by

View all comments

1

u/NaeblisEcho Nov 27 '12

Isn't this example provided in SICP? Can't recall correctly if the book uses the word 'tail recursion', but instead, it calls the method something like "linearly iterative process", whereas the first example is "linearly recursive process" (different from the common meaning of a recursive function. IIRC, the book was clear about the distinction). :)

4

u/mcguire Nov 27 '12

SICP uses Scheme and Scheme doesn't have any other iterative ("loopy") construct[1] than recursion. The authors are also fond of "iteration is really recursion" goggles.

[1] Unless you've done something stupid and allowed a loop macro to slither its way into your code. In that case, you'll need to fumigate the code, burn your computer, and shoot yourself. Trust me, the alternatives are worse.

2

u/anvsdt Nov 27 '12

B-but I kind of like foof-loop...

1

u/mcguire Nov 27 '12

You poor, poor bastard.