4 ms·
How is 'structure your code to make tail calls' any different from 'annotate "I want this optimization"'?
by jfager 17y ago
How is 'structure your code to make tail calls' any different from 'annotate "I want this optimization"'?
- jrockway 17y agoPresumably tail-recursion is the natural expression of your algorithm. (I will admit that I wish the compiler could optimize something of the form "sum (x:xs) = x + sum xs"; instead you have to write "sum k (x:xs) = sum (k + x) xs".)