A novel representation of lists and its application to the function “reverse”

https://doi.org/10.1016/0020-0190(86)90059-1Get rights and content

Abstract

A representation of lists as first-class functions is proposed. Lists represented in this way can be appended together in constant time, and can be converted back into ordinary lists in time proportional to their length. Programs which construct lists using append can often be improved by using this representation. For example, naive reverse can be made to run in linear time, and the conventional ‘fast reverse’ can then be derived easily. Examples are given in KRC (Turner, 1982), the notation being explained as it is introduced. The method can be compared to Sleep and Holmström's proposal (1982) to achieve a similar effect by a change to the interpreter.

References (3)

  • R.S. Bird

    Transformational Programming and the Paragraph Problem

    (1984)
There are more references available in the full text version of this article.

Cited by (96)

  • A framework for higher-order effects & handlers

    2024, Science of Computer Programming
  • A Historical Perspective on Program Transformation and Recent Developments (Invited Contribution)

    2024, PEPM 2024 - Proceedings of the 2024 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation, Co-located with: POPL 2024
View all citing articles on Scopus

This work was carried out with the support of a Research Fellowship from the U.K. Science and Engineering Research Council.

View full text