January 2018

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

Page Summary

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)
Tuesday, September 6th, 2011 07:53 pm (UTC)
[url=http://pharmacyshop-online.com]buy generic viagra usa[/url] Generic Viagra we put forward is close by in 50mg and 100mg tabs. These are fixed dosages of Sildenafil (the active ingredient) in the pills: thus a 50mg Viagra remedy contains 50 mg of Sildenafil congregate and a 100mg Viagra bolus contains 100mg of Sildenafil. The precept dose in favour of achieving the effect is a 50mg pill. Even so, the ingredient effects different people in a odd way so we would commend you to start with 25mg (split a 50mg troche in two and settle song half alone) to get a load of if this is sufficient for the benefit of you. If not - extract a mostly 50mg pill. [url=http://pharmacyshop-online.com]viagra online no prescription[/url]