问题描述
最近我一直在阅读关于函数式编程的一些知识,并且我正在努力研究Y-Combinator。我知道您可以使用Y-Combinator以不直接支持递归的语言有效地实现递归。然而,我可能使用的每种语言已经支持递归,所以我不确定使用Y-Combinator是多么有用。
是我错过了Y-Combinator使用的更好的实例吗?有没有人真的在实际生产代码中使用过?或者是使用Y-Combinator实际上只是一种令人挠头的学术练习(尽管它非常酷)。
m会不同意其他答案:定点(Y)组合器确实具有实际应用,但需要一个非常富有想象力的头脑才能找到它们。像布鲁斯麦克亚当。这是他的论文摘要:这是一篇很棒的论文。任何对函数式编程感兴趣的人都可能喜欢阅读它。
I've been reading a bit lately about functional programming and I am trying to grok the Y-Combinator. I understand that you can use the Y-Combinator to effectively implement recursion in a language that doesn't support recursion directly. However, every language that I'm likely to use already supports recursion so I'm not sure how useful it would be to use the Y-Combinator for that.
Is there a better practical example of Y-Combinator usage that I'm missing? Has anyone actually used one in real production code? Or is using the Y-Combinator really just a mind-bending academic exercise (albeit a pretty cool one).
I'm going to disagree with other answers: The fixed-point (Y) combinator does have practical applications, but it takes a very imaginative mind to find them. Like Bruce McAdam. Here's the abstract from his paper That About Wraps it Up:
It's a great paper; anyone interested in functional programming will probably enjoy reading it.
这篇关于Y-Combinator实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!