Recursion Patterns and Their Impact on Programming Language Design (original) (raw)
Related papers
Fundamentals, Prospects and Challenges for Totally Functional Programming Style
2014
General recursive definitions contribute to the complexity of programming. This complexity could be reduced by reliance on established, well-understood programming patterns. Catamorphism-based recursion patterns simplify programming with little practical loss in expressive capability compared to general recursion, including the capability of defining new recursion patterns. Partial application of catamorphisms, sub-catamorphic recursion patterns and methods to symbolic data allows a comprehensive replacement of symbolic data with functional, or what we describe as “zoetic”, representations that inherently adopt the benefits of catamorphism-based programming. The considerable promise of this “Totally Functional” style confronts us with some exciting technical challenges. Keywords-component; Catamorphism, Fold, Functional, Recursion.
Higher-Order Catamorphisms as Bases for Program Structuring and Design Recovery
Artificial Intelligence and Applications / 794: Modelling, Identification and Control / 795: Parallel and Distributed Computing and Networks / 796: Software Engineering / 792: Web-based Education, 2013
Catamorphisms ("foldr" on lists, but generally applicable to any regular recursive datatype) are not just useful but are an effective basis for a recursion-pattern-based discipline of program design. A new presentation for catamorphisms makes it clear how they provide functional semantics for symbolic datatypes, with the capacity to expose significant variations in program design. A further development of the new presentation exploits the higherorder capabilities of functional languages. This is the key enabler for a comprehensive replacement of symbolic data and their interpreters, either implicit or explicit, with direct functional representations. These extensions, of the applicability of catamorphisms and of their presentations, make them even more attractive as bases for program structuring and design, and likewise as targets for software reverse engineering and design recovery. KEY WORDS Software design and development; Programming Tools and languages; Functional programming; Recursion pattern. 2 Catamorphisms are Useful Catamorphisms represent a general, indeed generic recursion pattern on regular recursive datatypes. The design of programs is improved by expressing their recursive components as explicit instantiations of these general patterns.
Recursion, Iteration and Functional Languages
1998
Functional programming languages are shown to be useful in the teaching of the concepts of recursion and iteration. The functional language approach presented in this paper has advantages over imperative languages in the area of analysis of recursive and iterative algorithms. Examples using the J and Scheme programming languages, with emphasis on the use of functional programming notation in exposition are given. 1
Syntactic Considerations on Recursive Types
1996
We study recursive types from a syntactic perspective. In particular, we compare the formulations of recursive types that are used in programming languages and formal systems. Our main tool is a new syntactic explanation of type expressions as functors. We also introduce a simple logic for programs with recursive types in which we carry out our proofs. 1 Introduction Recursive types are common in both programming languages and formal systems. By now, there is a deep and well-developed semantic theory of recursive types. The syntactic aspects of recursive types are also well understood in some special cases. In particular, there is an important body of knowledge about covariant recursive types, which include datatypes like natural numbers, lists, and trees. Beyond the covariant case, however, the syntactic understanding of recursive types becomes rather spotty. Consequently, the relations between various alternative formulations of recursive types are generally unclear. Furthermore, ...
Data Abstraction and General Recursion
1991
Existing approaches to semantics of algebraically specified data types such as Initial Algebra Semantics and Final Algebra Semantics do not take into account the possibility of general recursion and hence nontermination in the ambient programming language. Any technical development of this problem needs to be in the setting of domain theory. In this paper we present extensions of initial and final algebra semantics to algebras with an underlying domain structure. Four possibilities for specification methodologies arise: two each in the Initial and Final algebra paradigms. We demonstrate that the initial/final objects (as appropriate) exist in all four situations. The final part of the paper attempts to explicate the notion of abstractness of ADT's by defining a notion of operational semantics for ADT's, and then studying the relationship between the various algebraic-semantics proposed and the operational semantics. Comments University of Pennsylvania Department of Computer ...
A type system for well-founded recursion
ACM SIGPLAN Notices, 2004
In the interest of designing a recursive module extension to ML that is as simple and general as possible, we propose a novel type system for general recursion over effectful expressions. The presence of effects seems to necessitate a backpatching semantics for recursion based on Scheme's. Our type system ensures statically that recursion is well-founded (that the body of a recursive expression will evaluate without attempting to access the undefined recursive variable), which avoids some unnecessary run-time costs associated with backpatching. To ensure well-founded recursion in the presence of multiple recursive variables and separate compilation, we track the usage of individual recursive variables, represented statically by "names". So that our type system may eventually be integrated smoothly into ML's, reasoning involving names is only required inside code that uses our recursive construct and does not need to infect existing ML code.
Program recursive forms and programming automatization for functional languages
WSEAS Transactions on Computers archive, 2009
The automatic programming system has been considered by means of which it becomes easier to carry out traditional programming stages. There is discussed both recursive forms: parallel, interrecursion and recursion of high level that exist for functional programming languages and induction methods for the purpose of their verification. The way how to present imperative languages easy and double cycles by means of recursion forms is shown, the possibility of verification has been studied for each recursion form.
Some Remarks on Type Systems for Course-of-value Recursion
Electronic Notes in Theoretical Computer Science, 2009
Course-of-value recursion is a scheme which allows us to define the value of a function in some argument of an inductive structure by using not only the immediate, but arbitrary previously computed values. In the categorical approach to typed (total) functional programming, where datatypes (codatatypes) are initial algebras (final coalgebras), one models this principle by a construction called histomorphism. On the other hand, it is known that other categorical principles such as catamorphisms and anamorphisms representing definitions by iteration and coiteration have been successfully used to implement safe type systems extending the second-order polymorphic lambda calculus, system F. Hence it is natural to pursuit the definition and implementation of fold operators corresponding to course-of-value recursion as well. This paper proposes some new such extensions and states some important remarks emerged while verifying the correctness and safety properties of their operational semantics, relying not only on the categorical, but also on the logical approach based on fixed-point operators. Our observations should be considered as a starting point for a deeper study of the interrelation between these two approaches.