Jonnalagedda, ManoharStucki, Sandro2015-06-172015-06-172015-06-17201510.1145/2774975.2774981https://infoscience.epfl.ch/handle/20.500.14299/115175Fusion is a program optimisation technique commonly implemented using special-purpose compiler support. In this paper, we present an alternative approach, implementing fold-based fusion as a standalone library. We use staging to compose operations on folds; the operations are partially evaluated away, yielding code that does not construct unnecessary intermediate data structures. The technique extends to partitioning and grouping of collections.Program optimisationdeforestationfoldfusionmulti-stage programmingFold-based fusion as a library: a generative programming pearltext::conference output::conference proceedings::conference paper