Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does C# do tail recursion? [duplicate]

Possible Duplicate:
Why doesn't .net/C# eliminate tail recursion?

Does C# do tail recusion?

I can't find any documentation telling me if it does or not.

like image 464
Vilor Avatar asked Aug 18 '11 04:08

Vilor


People also ask

Does hep C go away?

It is highly curable ... Direct-acting antiviral medications — given over a 12-week period — actually can cure early acute hepatitis C better than 90% of the time.

What is || in C programming?

Logical OR operator: || The logical OR operator ( || ) returns the boolean value true if either or both operands is true and returns false otherwise. The operands are implicitly converted to type bool before evaluation, and the result is of type bool .

How long does hep C take to show up?

The hepatitis C (HCV) window period is usually 4–10 weeks from the time of exposure. After 6 months , most people will have developed enough antibodies for an HCV test to detect. In rare cases, however, antibodies can take up to 9 months to develop.


2 Answers

Unfortunately, it does not, at least not yet.

I'm not sure if the standard itself specifies anything about (dis)allowing tail recursion. Regardless, since .Net supports tail recursion, so it would be nice for this to make its way into C#.

If you really need tail recursion in a .Net language, consider F# as an alternative.

like image 34
Ken Wayne VanderLinde Avatar answered Sep 30 '22 19:09

Ken Wayne VanderLinde


C# does not innately support tail recursion in the language but here is an interesting article on a similar technique call trampolining that may help you in your situation

like image 69
Chris McGrath Avatar answered Sep 30 '22 17:09

Chris McGrath