Is there an obvious way to confirm if a function is tail recursive?

Is there any way to tell if a function in F# is tail-recursive?

I've tried to explain it, but some people seem to struggle and ask if there's a way to confirm what they've done is tail recursive. Is there anything easy you can do (other than trying to make it overflow the stack) to confirm tail responsiveness (or not) (preferably in the IDE)?

(I tried Reflector, but it just crashes on me when I open F# projects!)


From here (with several examples in the article):

How can I verify that tail calls are being used?

The easiest way is to ensure that tail calls are being used is to understand and apply the rules from the previous section. While the F# compiler itself doesn't currently provide any way to verify that tail calls have been used at a particular call site, you can be sure by looking at the compiled version of the code using the MSIL Dissasembler (ildasm.exe). We'll see several examples below.

链接地址: http://www.djcxy.com/p/80530.html

上一篇: F#中的尾部递归性:使用Quicksort进行反转

下一篇: 是否有一种明显的方法来确认一个函数是否是递归的?