The Universality and Expressiveness of std::accumulate

Research output: Contribution to journalArticlepeer-review

2 Downloads (Pure)


Graham Hutton’s 1999 monograph: A tutorial on the universality and expressiveness of fold provides a fascinating and eminently readable analysis of an elementary reduction operator from functional programming: fold. Hutton’s tutorial is punctuated by increasingly compelling examples, written in Haskell, of the use of fold to implement common list operations, including summation; concatenation; reversal; function composition; left folds; and concluding with the Ackermann function. The fold combinator is directly comparable to the C++ standard library function: std::accumulate. In this article, I focus on the fold examples from Hutton, and present equivalent generic C++ incarnations of each; making thorough use of appropriate C++14 library and language features, including polymorphic lambda functions
Original languageEnglish
Article number2182
Pages (from-to)13-15
Number of pages3
Issue number130
Publication statusPublished - Dec 2015


  • fold
  • catamorphism
  • C++
  • ackermann
  • accumulate


Dive into the research topics of 'The Universality and Expressiveness of std::accumulate'. Together they form a unique fingerprint.

Cite this