January 2018

S M T W T F S
  123456
78910111213
14151617181920
21222324252627
28293031   

Style Credit

Expand Cut Tags

No cut tags
Monday, September 3rd, 2007 12:41 am
I have a question for the CS types out there: what exactly is the point of tail-call elimination?

Before you go into great detail about stack overflows, rest assured that I understand that bit. But why is tail-recursive code considered such a good thing? I mean, you write your code in a non-obvious way so that the optimiser can turn it into the loop that you meant to write in the first place. Why not just write the loop yourself? It has the same effect, expresses your intent more clearly, and doesn't require the mental gymnastics to make your code tail-recursive, or to decode it when reading.

I can see why you need it if you're determined to make your language stateless (though actually, that's a related question: how is recursive code with accumulators any safer than iterative code with local state?), but why is it needed in languages like Lisp, which already have perfectly good looping constructs?

Don't get me wrong: recursion is clearly a Good Thing. But all the really interesting uses of recursion, it seems to me, are things like recursion on trees or other data structures, which are not in general tail-recursive.

In other hacking news, I spent much of my evening making a set of spice racks out of chopsticks, duct tape and strawberry boxes. My kitchen is now a fraction tidier.
(Anonymous)
Thursday, September 22nd, 2011 04:23 am (UTC)
[url=http://onlinepharmacy-levitra.com]generic levitra online without prescription[/url]
Generic Levitra is tolerant of to curing propagative ritual problems such as Feebleness or Erectile Dysfunction. Levitra® is a medciation for the treatment of manly Helplessness manufactured by means of Bayer Pharmaceuticals Corp. It helps to archieve and maintain erection.
[url=http://onlinepharmacy-levitra.com]generic levitra online no prescription[/url]