我想我需要详细说明 D 函数在 unlambda 中的工作原理。现在我正在尝试使用 Y 组合器创建一个函数(阶乘),但它总是会导致某种无限循环。或段错误,取决于解释器。我很确定 D 是我想在这里使用的。我试过这个:
``d```sii``sii`.xi
它有相同的无限循环。有人认为他们可以帮助我理解 unlambda 中的 D 吗?
...
在 unlambda 表示法中,我的功能是
```s``s``s`ks``s`kki``s``s`ks`ki`ki``s``s`ks``s`kki``s``s`ks`ki`ki``s`k`s``s``s``s``si`k`ki`k``s``si`k`ki`kk`k`ki`k`s`sk``s`k`s``s`ksk``s``s`ksk`k``s``si`k``s``s``s``si`ki`k`ki`k`ki`s``s`ksk`k`k`kk
Y= ``s``s``s`ks``s`kki``s``s`ks`ki`ki``s``s`ks``s`kki``s``s`ks`ki`ki
Factorial = Y(\xy.0y1(My(x(Sy))))
0 = ``s``s``si`k`ki`k``s``si`k`ki`kk`k`ki (Returns K if it's 0 in church numerals, Returns KI if it's something else.)
M = ``s`ksk (Prefix multiplier of church numerals)
S = ``s``si`k``s``s``s``si`ki`k`ki`k`ki`s``s`ksk`k`k`kk (Decrements a church integer)
我很确定如果它被正常评估,首先是左边,它会起作用,但我不确定。
提前致谢。