A Novel Representation of Lists and its Application to the Function "reverse"
暂无分享,去创建一个
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 Holmstrom's proposal (1982) to achieve a similar effect by a change to the interpreter.
[1] M. R. Sleep,et al. A short note concerning lazy reduction rules for append , 1982 .
[2] Richard S. Bird. Transformational Programming and the Paragraph Problem , 1986, Sci. Comput. Program..