Results 1  10
of
11
Polytypic programming
, 2000
"... ... PolyP extends a functional language (a subset of Haskell) with a construct for defining polytypic functions by induction on the structure of userdefined datatypes. Programs in the extended language are translated to Haskell. PolyLib contains powerful structured recursion operators like catamorp ..."
Abstract

Cited by 94 (11 self)
 Add to MetaCart
(Show Context)
... PolyP extends a functional language (a subset of Haskell) with a construct for defining polytypic functions by induction on the structure of userdefined datatypes. Programs in the extended language are translated to Haskell. PolyLib contains powerful structured recursion operators like catamorphisms, maps and traversals, as well as polytypic versions of a number of standard functions from functional programming: sum, length, zip, (==), (6), etc. Both the specification of the library and a PolyP implementation are presented.
Merging Monads and Folds for Functional Programming
 In Advanced Functional Programming, LNCS 925
, 1995
"... . These notes discuss the simultaneous use of generalised fold operators and monads to structure functional programs. Generalised fold operators structure programs after the decomposition of the value they consume. Monads structure programs after the computation of the value they produce. Our progra ..."
Abstract

Cited by 50 (2 self)
 Add to MetaCart
. These notes discuss the simultaneous use of generalised fold operators and monads to structure functional programs. Generalised fold operators structure programs after the decomposition of the value they consume. Monads structure programs after the computation of the value they produce. Our programs abstract both from the recursive processing of their input as well as from the sideeffects in computing their output. We show how generalised monadic folds aid in calculating an efficient graph reduction engine from an inefficient specification. 1 Introduction Should I structure my program after the decomposition of the value it consumes or after the computation of the value it produces? Some [Bir89, Mee86, Mal90, Jeu90, MFP91] argue in favour of structuring programs after the decomposition of the value they consume. Such syntax directed programs are written using a limited set of recursion functionals. These functionals, called catamorphisms or generalised fold operators are naturally ...
Fast and Loose Reasoning is Morally Correct
, 2006
"... Functional programmers often reason about programs as if they were written in a total language, expecting the results to carry over to nontotal (partial) languages. We justify such reasoning. ..."
Abstract

Cited by 33 (1 self)
 Add to MetaCart
Functional programmers often reason about programs as if they were written in a total language, expecting the results to carry over to nontotal (partial) languages. We justify such reasoning.
Polytypic Pattern Matching
 In Conference Record of FPCA '95, SIGPLANSIGARCHWG2.8 Conference on Functional Programming Languages and Computer Architecture
, 1995
"... The (exact) pattern matching problem can be informally specified as follows: given a pattern and a text, find all occurrences of the pattern in the text. The pattern and the text may both be lists, or they may both be trees, or they may both be multidimensional arrays, etc. This paper describes a g ..."
Abstract

Cited by 28 (8 self)
 Add to MetaCart
(Show Context)
The (exact) pattern matching problem can be informally specified as follows: given a pattern and a text, find all occurrences of the pattern in the text. The pattern and the text may both be lists, or they may both be trees, or they may both be multidimensional arrays, etc. This paper describes a general patternmatching algorithm for all datatypes definable as an initial object in a category of F algebras, where F is a regular functor. This class of datatypes includes mutual recursive datatypes and lots of different kinds of trees. The algorithm is a generalisation of the Knuth, Morris, Pratt like patternmatching algorithm on trees first described by Hoffmann and O'Donnell. 1 Introduction Most editors provide a search function that takes a string of symbols and returns the first position in the text being edited at which this string of symbols occurs. The string of symbols is called a pattern, and the algorithm that detects the position at which a pattern occurs is called a (exa...
Solving Optimisation Problems with Catamorphisms
, 1992
"... . This paper contributes to an ongoing effort to construct a calculus for deriving programs for optimisation problems. The calculus is built around the notion of initial data types and catamorphisms which are homomorphisms on initial data types. It is shown how certain optimisation problems, which a ..."
Abstract

Cited by 12 (3 self)
 Add to MetaCart
. This paper contributes to an ongoing effort to construct a calculus for deriving programs for optimisation problems. The calculus is built around the notion of initial data types and catamorphisms which are homomorphisms on initial data types. It is shown how certain optimisation problems, which are specified in terms of a relational catamorphism, can be solved by means of a functional catamorphism. The result is illustrated with a derivation of Kruskal's algorithm for finding a minimum spanning tree in a connected graph. 1 Introduction Efficient algorithms for solving optimisation problems can sometimes be expressed as homomorphisms on initial data types. Such homomorphisms, which correspond to the familiar fold operators in functional programming, are called catamorphisms. In this paper, we give conditions under which an optimisation problem can be solved by a catamorphism. Our results are a natural generalisation of earlier work by Jeuring [5, 6], who considered the same problem ...
The derivation of online algorithms, with an application to finding palindromes
 Algorithmica
, 1994
"... Abstract. A theory for the derivation of online algorithms is presented. The algorithms are derived in the BirdMeertens calculus for program transformations. This calculus provides a concise functional notation for algorithms, and a few powerful theorems for proving equalities of functions. The th ..."
Abstract

Cited by 9 (4 self)
 Add to MetaCart
(Show Context)
Abstract. A theory for the derivation of online algorithms is presented. The algorithms are derived in the BirdMeertens calculus for program transformations. This calculus provides a concise functional notation for algorithms, and a few powerful theorems for proving equalities of functions. The theory for the derivation of online algorithms is illustrated with the derivation of an algorithm for finding palindromes. An online lineartime random access machine (RAM) algorithm for finding the longest palindromic substring in a string is derived, For the purpose of finding the longest palindromic substring, all maximal palindromic substrings are computed. The list of maximal palindromes obtained in the computation of the longest palindrome can be used for other purposes such as finding the largest palindromic rectangle in a matrix and finding the shortest partition of a string into palindromes. Key Words. Derivation of online algorithms, Transformational programming, BirdMeertens calcu
Functional polytypic programming  use and implementation
, 1997
"... Many functions have to be written over and over again for different datatypes, either because datatypes change during the development of programs, or because functions with similar functionality are needed on different datatypes. Examples of such functions are pretty printers, pattern matchers, equ ..."
Abstract

Cited by 6 (2 self)
 Add to MetaCart
(Show Context)
Many functions have to be written over and over again for different datatypes, either because datatypes change during the development of programs, or because functions with similar functionality are needed on different datatypes. Examples of such functions are pretty printers, pattern matchers, equality functions, unifiers, rewriting functions, etc. Such functions are called polytypic functions. A polytypic function is a function that is defined by induction on the structure of userdefined datatypes. This thesis introduces polytypic functions, shows how to construct and reason about polytypic functions and describes the implementation of the polytypic programming system PolyP. PolyP extends a functional language (a subset of Haskell) with a construct for writing polytypic functions. The extended language type checks definitions of polytypic functions, and infers the types of all other expressions. Programs in the extended language are translated to Haskell.
Incremental Algorithms on Lists
 Proceedings SION Computing Science in the Netherlands
, 1991
"... Incremental computations can improve the performance of interactive programs such as spreadsheet programs, program development environments, text editors, etc. Incremental algorithms describe how to compute a required value depending on the input, after the input has been edited. By considering the ..."
Abstract

Cited by 4 (4 self)
 Add to MetaCart
(Show Context)
Incremental computations can improve the performance of interactive programs such as spreadsheet programs, program development environments, text editors, etc. Incremental algorithms describe how to compute a required value depending on the input, after the input has been edited. By considering the possible different edit actions on the data type lists, the basic data type used in spreadsheet programs and text editors, we define incremental algorithms on lists. Some theory for the construction of incremental algorithms is developed, and we give an incremental algorithm for a more involved example: formatting a text. CR categories and descriptors: D11 [Software]: Programming Techniques  Applicative Programming, D43 [Software]: Programming Languages  Language constructs, I22 [Artificial Intelligence]: Automatic Programming  Program transformation. General terms: algorithm, design, theory. Additional keywords and phrases: BirdMeertens calculus for program construction, incremen...
Using underspecification in the derivation of some optimal partition algorithms
, 1990
"... Indeterminacy is inherent in the specification of optimal partition (and many more) algorithms, even though the algorithms themselves may be fully determinate. Indeterminacy is a notoriously hard phenomenon to deal with in a purely functional setting. In the paper “A Calculus Of Functions for Progra ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
(Show Context)
Indeterminacy is inherent in the specification of optimal partition (and many more) algorithms, even though the algorithms themselves may be fully determinate. Indeterminacy is a notoriously hard phenomenon to deal with in a purely functional setting. In the paper “A Calculus Of Functions for Program Derivation ” R. S. Bird tries to handle it by using underspecified functions. (Other authors have proposed to use ‘indeterminate ’ functions, and to use relations instead of functions.) In this paper we redo Bird’s derivation of the Leery and Greedy algorithm while being very precise about underspecification, and still staying in the functional framework. It turns out that Bird’s theorems are not exactly what one would like to have, and what one might understand from his wording of the theorems. We also give a derivation in the BirdMeertens style of a (linear time) optimal partition algorithm that was originally found by J. C. S. P. van der Woude. 1
Polytypism and Polytypic Unification
, 1995
"... This report describes what polytypic programming is, a new system for writing polytypic functions, and a number of useful example functions including generalised versions of map, zip and a specific lazy array based unification algorithm. Sammanfattning Denna rapport beskriver hur man med ett program ..."
Abstract
 Add to MetaCart
This report describes what polytypic programming is, a new system for writing polytypic functions, and a number of useful example functions including generalised versions of map, zip and a specific lazy array based unification algorithm. Sammanfattning Denna rapport beskriver hur man med ett programsystem automatiskt kan generera funktioner som fungerar fr alla trdtyper och detta systems tillmpning p ett antal anvndbara funktioner som map, zip och en speciell unifieringsalgoritm baserad p lata flt. 2 Polytypism and polytypic unification 1 Introduction 3 1.1 Background 3 1.2 Preliminaries and notation 4 1.3 Overview 4 2 Polytypism 5 2.1 Map 5 2.2 Cata 5 2.3 Functors 7 3 Basic polytypic functions 10 3.1 Predefined functions and types 10 3.1.1 Products 10 3.1.2 Sums 11 3.2 Notation 11 3.3 Object and arrow 12 3.4 In and out 13 3.5 Map 14 3.6 Cata 15 3.7 Ana 16 3.8 Hylo 16 3.9 Flatten 17 3.10 Partial functions 18 3.11 Zip 19 4 Program construction combinators 20 4.1 A combinator ...