New families of combinators for efficient list manipulation
Abstract In most contemporary functional programming languages, the list data type is one of the primary compound data domains provided to the programmer. Lists are appropriate for a large class of problems; however, the lack of arraylike operators (e.g., index) makes lists an inefficient way to represent direct-access data structures. Although these types of operators can be added to a programming language without disturbing the desirable properties of the language (e.g., referential transparency), these features will most likely then be translated into machine-level constructs that still do not process lists in an efficient manner. In this article, we focus on improving the list-processing capabilities of a functional language that is implemented by a combinator-based graph reduction architecture. We introduce new families of combinators that express certain commonly occurring combinations of lists or elements of lists as functions of those lists or elements of lists. A reduction rule (defined for each family) states that when a combinator is applied to a list with a finite series of elements, the resulting combination reduces to a certain combination of the list elements. An efficient implementation of these combinators demands a list representation that is different from the conventional recursively defined list structure. For comparison purposes, however, the reduction semantics of the new combinators will be represented as reductions of equivalent strings of already known combinators.