Tail recursion in C#(tomlev2.wordpress.com)

submitted by tom103tom103(161) 8 months, 19 days ago

This article briefly explains what tail recursion is, and explores various ways to implement it in C#.

8 comments |category: |Views: 79

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by dpetersondpeterson(4397) 8 months, 18 days ago 0

The F# compiler does in fact support tail recursion correct? Do you think it's a better approach to mix F# and C# or to implement one of the methods you outlined in C#?

Reply

posted by tom103tom103(161) replied to dpetersondpeterson(4397), 8 months, 18 days ago +1

I don't know much about F#, but according to this article by Bart de Smet, the F# compiler transforms recursive tail calls to loops. For non-recursive tail calls, it uses the tail IL instruction
http://bartdesmet.net/blogs/bart/archive/2009/11/08/jumping-the-trampoline-in-c-stack-friendly-recursion.aspx

Reply

posted by tom103tom103(161) replied to dpetersondpeterson(4397), 8 months, 18 days ago 0

I don't know much about F#, but according to this article by Bart de Smet, the F# compiler transforms recursive tail calls to loops. For non-recursive tail calls, it uses the tail IL instruction
http://bartdesmet.net/blogs/bart/archive/2009/11/08/jumping-the-trampoline-in-c-stack-friendly-recursion.aspx

Reply

posted by tom103tom103(161) replied to dpetersondpeterson(4397), 8 months, 18 days ago 0

I don't know much about F#, but according to this article by Bart de Smet, the F# compiler transforms recursive tail calls to loops. For non-recursive tail calls, it uses the tail IL instruction
http://bartdesmet.net/blogs/bart/archive/2009/11/08/jumping-the-trampoline-in-c-stack-friendly-recursion.aspx

Reply

posted by tom103tom103(161) replied to dpetersondpeterson(4397), 8 months, 18 days ago 0

I don't know much about F#, but according to this article by Bart de Smet, the F# compiler transforms recursive tail calls to loops. For non-recursive tail calls, it uses the tail IL instruction
http://bartdesmet.net/blogs/bart/archive/2009/11/08/jumping-the-trampoline-in-c-stack-friendly-recursion.aspx

Reply

posted by tom103tom103(161) replied to dpetersondpeterson(4397), 8 months, 18 days ago 0

Sorry about the duplicate reply... I'm having connection problems, and it didn't seem to work the first time

Reply

posted by dpetersondpeterson(4397) replied to tom103tom103(161), 8 months, 18 days ago 0

Ha ha, yikes. No worries, thanks for the response.

Reply

posted by vijaystvijayst(1311) 8 months, 14 days ago 0

Good article. thanks.

Reply

information Login or create an account to comment on this story