arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2103.06913cs.PL
收藏

经典(共)递归:编程

Classical (Co)Recursion: Programming

Paul Downen, Zena M. Ariola

摘要:

我们在这里的目的是说明如何在比以前认为的更广泛的编程领域中发现结构协递归的好处。从一个教程结构共递归的总,纯函数语言Agda开始,我们展示了这些相同的想法是如何映射到熟悉的概念,在各种不同的语言。我们展示了如何在Scheme等严格的函数式语言中实现协递归,甚至完全摆脱函数式范式,在Python和Java等语言中常见的面向对象特性的自然表达中表现出来。将结构协递归开放给更广泛的语言和范式选择--因此,也开放给更大的程序员受众--让我们也可以问协递归如何与计算效果相互作用。值得注意的是,我们证明了结构协同递归与效果相结合可以增加其表达能力。我们展示了一个经典版本的corecursion -使用Scheme的经典调用/cc实现的一流控制-使我们能够编写一些新的流处理算法,这些算法在无效果语言中是不可能的。

英文摘要:

Our aim here is to illustrate how the benefits of structural corecursion can be found in a broader swath of the programming landscape than previously thought. Beginning from a tutorial on structural corecursion in the total, pure functional language Agda, we show how these same ideas are mapped to familiar concepts in a variety of different languages. We show how corecursion can be done in strict functional languages like Scheme, and even escapes the functional paradigm entirely, showing up in the natural expression of common object-oriented features found in languages like Python and Java. Opening up structural corecursion to a much wider selection of languages and paradigms -- and therefore, also to a much larger audience of programmers -- lets us also ask how corecursion interacts with computational effects. Of note, we demonstrate that combining structural corecursion with effects can increase its expressive power. We show a classical version of corecursion -- using first-class control made possible by Scheme's classical call/cc -- that enables us to write some new stream-processing algorithms that aren't possible in effect-free languages.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑