SML 中的原型功能

发布于 2024-07-05 20:51:10 字数 154 浏览 6 评论 0原文

我有两个函数,fg,它们递归地相互调用。 不幸的是,当f调用g时,它还没有被声明,所以我得到一个“未绑定变量”错误。 我如何在 SML/NJ 中构建此函数的原型(或任何等效词汇)?

I have two functions, f and g, which call each other recursively. Unfortunately, when f calls g, it has not yet been declared, so I get an "unbound variable" error. How can I prototype (or whatever the equivalent vocabulary is) this function in SML/NJ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

命硬 2024-07-12 20:51:10

使用

fun f x = ... 
and g x = ...

更多信息 在这里

Use and:

fun f x = ... 
and g x = ...

More info here.

拥有 2024-07-12 20:51:10

相互递归。 在两个函数之间使用 and 而不是 fun

Mutual Recursion. Use and instead of fun between the two functions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文