首页    期刊浏览 2024年12月01日 星期日
登录注册

文章基本信息

  • 标题:Maximum Segment Sum, Monadically (distilled tutorial)
  • 本地全文:下载
  • 作者:Jeremy Gibbons
  • 期刊名称:Electronic Proceedings in Theoretical Computer Science
  • 电子版ISSN:2075-2180
  • 出版年度:2011
  • 卷号:66
  • 页码:181-194
  • DOI:10.4204/EPTCS.66.9
  • 出版社:Open Publishing Association
  • 摘要: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.
国家哲学社会科学文献中心版权所有