可以将F#函数视为尾部递归吗,它使用TailCall .net操作码 [英] Can an F# function be considered tail recursive it uses the TailCall .net opcode

查看:63
本文介绍了可以将F#函数视为尾部递归吗,它使用TailCall .net操作码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于.net具有 TailCall 操作码 如果F#函数确实是尾递归的,可以用来确定吗?

Since .net has the TailCall opcode, can this be used to deterime if an F# function is truly tail recursive?

如果是真的,有没有人做过一个VS插件来识别尾部功能和非尾部功能?

If it is true, has anyone made a VS add-in that identifies tail and non-tail functions?

推荐答案

请参见

See this blog post on the F# team blog for a summary of how F# compiles tail calls.

简而言之,

  1. 直接递归尾部调用通常会转换为循环.
  2. 相互递归和间接非递归尾部调用通常会转换为.NET尾部调用.

但请参阅完整的帖子,了解所有血腥细节.

but see the full post for all of the gory details.

这篇关于可以将F#函数视为尾部递归吗,它使用TailCall .net操作码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆