Automatic transformation of series expressions into loops

The benefits of programming in a functional style are well known. In particular, algorithms that are expressed as compositions of functions operating on sequences/vectors/streams of data elements are easier to understand and modify than equivalent algorithms expressed as loops. Unfortunately, this kind of expression is not used anywhere near as often as it could be, for at least three reasons: (1) most programmers are less familiar with this kind of expression than with loops; (2) most programming languages provide poor support for this kind of expression; and (3) when support is provided, it is seldom effcient. In any programming language, the second and third problems can be largely solved by introducing a data type called series, a comprehensive set of procedures operating on series, and a preprocessor (or compiler extension) that automatically converts most series expressions into efficient loops. A set of restrictions specifies which series expressions can be optimized. If programmers stay within the limits imposed, they are guaranteed of high efficiency at all times. A common Lisp macro package supporting series has been in use for some time. A prototype demonnstrates that series can be straightforwardly supported in Pascal.

[1]  Judith Bishop,et al.  The Effect of Data Abstraction on Loop Programming Techniques , 1990, IEEE Trans. Software Eng..

[2]  Ralph E. Griswold,et al.  Seque: A Programming Language for Manipulating Sequences , 1988, Comput. Lang..

[3]  Amir Pnueli,et al.  Use of a Nonprocedural Specification Language and Associated Program Generator in Software Development , 1979, TOPL.

[4]  Robert D. Cameron Efficient high-level iteration with accumulators , 1989, TOPL.

[5]  Thomas R. Gross,et al.  Mapping a single-assignment language onto the Warp systolic array , 1987, FPCA.

[6]  Philip Wadler Listlessness is better than laziness II: composing listless functions , 1985, Programs as Data Objects.

[7]  John W. Backus,et al.  Can programming be liberated from the von Neumann style?: a functional style and its algebra of programs , 1978, CACM.

[8]  Edmond Schonberg,et al.  Programming with Sets: An Introduction to SETL , 1986 .

[9]  Richard C. Waters,et al.  Efficient interpretation of synchronizable series expressions , 1987, SIGPLAN '87.

[10]  Keshav Pingali,et al.  Efficient demand-driven evaluation. Part 1 , 1985, TOPL.

[11]  David Moon,et al.  LOOP Iteration Macro , 1980 .

[12]  Françoise Bellegarde Rewriting systems on FP expressions that reduce the number of sequences they yield , 1984, LFP '84.

[13]  Richard C. Waters,et al.  Expressional loops , 1984, POPL.

[14]  Richard C. Waters,et al.  The programmer's apprentice , 1990, ACM Press frontier series.

[15]  Daniel P. Friedman,et al.  CONS Should Not Evaluate its Arguments , 1976, ICALP.

[16]  Richard C. Waters Optimization of Series Expressions: Part I: User''s Manual for the Series Macro Package , 1989 .

[17]  Richard C. Waters Efficient interpretation of synchronizable series expressions , 1987, PLDI 1987.

[18]  Keshav Pingali,et al.  Efficient Demand-Driven Evaluation. , 1983 .

[19]  Raymond P. Polivka,et al.  APL: The Language and Its Usage , 1975 .

[20]  Mary Shaw,et al.  An introduction to the construction and verification of Alphard programs , 1976, ICSE '76.

[21]  J. Dana Eckart,et al.  Iteration and abstract data types , 1987, SIGP.

[22]  Alexander Aiken,et al.  Optimal loop parallelization , 1988, PLDI '88.

[23]  Bjarne Stroustrup,et al.  C++ Programming Language , 1986, IEEE Softw..

[24]  Warren Teitelman,et al.  The interlisp reference manual , 1974 .

[25]  Françoise Bellegarde,et al.  Convergent term rewriting systems can be used for program transformation , 1985, Programs as Data Objects.

[26]  Ken Kennedy,et al.  Automatic translation of FORTRAN programs to vector form , 1987, TOPL.

[27]  Richard S. Bird,et al.  An introduction to the theory of lists , 1987 .

[28]  Philip Wadler,et al.  Listlessness is better than laziness: Lazy evaluation and garbage collection at compile-time , 1984, LFP '84.

[29]  James E. Emery Small-scale software components , 1979, SOEN.

[30]  Paul Hudak,et al.  Code optimizations for lazy evaluation , 1988, LISP Symb. Comput..

[31]  Timothy Budd,et al.  An APL Compiler , 1987, Springer New York.

[32]  Leonidas J. Guibas,et al.  Compilation and delayed evaluation in APL , 1978, POPL.

[33]  Alfred V. Aho,et al.  The Design and Analysis of Computer Algorithms , 1974 .

[34]  Philip Wadler,et al.  Applicative style programming, program transformation, and list operators , 1981, FPCA '81.

[35]  Richard C. Waters Using obviously synchronizable series expressions instead of loops , 1988, Proceedings. 1988 International Conference on Computer Languages.

[36]  Guy L. Steele,et al.  Common Lisp the Language , 1984 .

[37]  Gilles Kahn,et al.  Coroutines and Networks of Parallel Processes , 1977, IFIP Congress.

[38]  Richard C. Waters,et al.  A Method for Analyzing Loop Programs , 1979, IEEE Transactions on Software Engineering.

[39]  Jonathan L. Orwant Support for Obviously Synchonizable Series Expressions in Pascal , 1988 .