Many recursive functions are linear in the sense that the number of recursive function calls they generate is bounded by a number which is proportional to the magnitude of their argument. The performance of functional languages can therefore be improved by a more efficient implementation of linear functions, and we derive equivalent imperative language loops for large class of linear recursive functions. Moreover, such linear functions can be detected automatically in the parsing phase of a compiler and their loop implementations generated. Other recursive functions are non-linear, generating a number of function calls that grows in a non-linear manner with respect to the magnitude of the arguments to which they are applied, for example quadratically or exponentially. Although non-linear functions tend to be fewer, their run-time performance tends to be relatively much poorer, and so their efficient implementation too is of considerable importance to functional languages. We illustrate how certain non-linear function definitions can be transformed into linear ones, and how they can therefore subsequently be implemented as loops. An alternative, more automatic approach for the treatment of non-linear functions that uses memo-functions is also considered.
CITATION STYLE
Harrison, P. G., & Khoshnevisan, H. (1988). ALGEBRAIC TRANSFORMATION TECHNIQUES FOR FUNCTIONAL LANGUAGES. Computer Journal, 31(3), 229–242. https://doi.org/10.1093/comjnl/31.3.229
Mendeley helps you to discover research relevant for your work.