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

最大段和,Monadically(蒸馏教程,与解决方案)

Maximum Segment Sum, Monadically (distilled tutorial, with solutions)

Jeremy Gibbons

摘要:

最大段和问题是计算给定的整数列表,该列表中相邻段的最大和。这个问题规范直接映射到一个时间算法上;然而,也有一个非常优雅的线性时间解决方案。该问题是程序构造数学中的经典练习,说明了计算发展,无点推理,代数结构和数据类型通用性等重要原则。在这里,我们从一元函数编程的角度,而不是传统的关系方法,对这个问题的数据类型泛型版本进行了一个侧面的研究;演示文稿是教程式的,并为读者提供了练习。

英文摘要:

The maximum segment sum problem is to compute, given a list of integers, the largest of the sums of the contiguous segments of that list. This problem specification maps directly onto a cubic-time algorithm; however, there is a very elegant linear-time solution too. The problem is a classic exercise in the mathematics of program construction, illustrating important principles such as calculational development, pointfree reasoning, algebraic structure, and datatype-genericity. Here, we take a sideways look at the datatype-generic version of the problem in terms of monadic functional programming, instead of the traditional relational approach; the presentation is tutorial in style, and leavened with exercises for the reader.

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

↑