Results 1  10
of
10
The essence of the Iterator pattern
 McBride, Conor, & Uustalu, Tarmo (eds), Mathematicallystructured functional programming
, 2006
"... The ITERATOR pattern gives a clean interface for elementbyelement access to a collection. Imperative iterations using the pattern have two simultaneous aspects: mapping and accumulating. Various existing functional iterations model one or other of these, but not both simultaneously. We argue that ..."
Abstract

Cited by 22 (7 self)
 Add to MetaCart
(Show Context)
The ITERATOR pattern gives a clean interface for elementbyelement access to a collection. Imperative iterations using the pattern have two simultaneous aspects: mapping and accumulating. Various existing functional iterations model one or other of these, but not both simultaneously. We argue that McBride and Paterson’s idioms, and in particular the corresponding traverse operator, do exactly this, and therefore capture the essence of the ITERATOR pattern. We present some axioms for traversal, and illustrate with a simple example, the repmin problem.
Proof Pearl: Defining Functions Over Finite Sets. volume 3603 of LNCS
 Information and Computation
, 2005
"... Abstract. Structural recursion over sets is meaningful only if the result is independent of the order in which the set’s elements are enumerated. This paper outlines a theory of function definition for finite sets, based on the fold functionals often used with lists. The fold functional is introduce ..."
Abstract

Cited by 11 (2 self)
 Add to MetaCart
Abstract. Structural recursion over sets is meaningful only if the result is independent of the order in which the set’s elements are enumerated. This paper outlines a theory of function definition for finite sets, based on the fold functionals often used with lists. The fold functional is introduced as a relation, which is then shown to denote a function under certain conditions. Applications include summation and maximum. The theory has been formalized using Isabelle/HOL. 1
Disciplined, efficient, generalised folds for nested datatypes
 UNDER CONSIDERATION FOR PUBLICATION IN FORMAL ASPECTS OF COMPUTING
"... Nested (or nonuniform, or nonregular) datatypes have recursive definitions in which the type parameter changes. Their folds are restricted in power due to type constraints. Bird and Paterson introduced generalised folds for extra power, but at the cost of a loss of efficiency: folds may take more ..."
Abstract

Cited by 6 (0 self)
 Add to MetaCart
Nested (or nonuniform, or nonregular) datatypes have recursive definitions in which the type parameter changes. Their folds are restricted in power due to type constraints. Bird and Paterson introduced generalised folds for extra power, but at the cost of a loss of efficiency: folds may take more than linear time to evaluate. Hinze introduced efficient generalised folds to counter this inefficiency, but did so in a pragmatic way: he did not provide categorical or equivalent underpinnings, so did not get the associated universal properties for manipulating folds. We combine the efficiency of Hinze’s construction with the powerful reasoning tools of Bird and Paterson’s.
Constructively characterizing fold and unfold
 In 13th International Symposium on Logicbased Program Synthesis and Transformation (LOPSTR 2003), held August 2527 in
, 2003
"... Abstract. In this paper we formally state and prove theorems characterizing when a function can be constructively reformulated using the recursion operators fold and unfold, i.e. given a function h, when can a function g be constructed such that h = fold g or h = unfold g? These results are refineme ..."
Abstract

Cited by 3 (2 self)
 Add to MetaCart
(Show Context)
Abstract. In this paper we formally state and prove theorems characterizing when a function can be constructively reformulated using the recursion operators fold and unfold, i.e. given a function h, when can a function g be constructed such that h = fold g or h = unfold g? These results are refinements of the classical characterization of fold and unfold given by Gibbons, Hutton and Altenkirch in [6]. The proofs presented here have been formalized in Nuprl’s constructive type theory [5] and thereby yield program transformations which map a function h (accompanied by the evidence that h satisfies the required conditions), to a function g such that h = fold g or, as the case may be, h = unfold g. 1
Polytypic Functional Programming and Data Abstraction
, 2006
"... Structural polymorphism is a generic programming technique known within the functional programming community under the names of polytypic or datatypegeneric programming. In this thesis we show that such a technique conflicts with the principle of data abstraction and propose a solution for reconcil ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
Structural polymorphism is a generic programming technique known within the functional programming community under the names of polytypic or datatypegeneric programming. In this thesis we show that such a technique conflicts with the principle of data abstraction and propose a solution for reconciliation. More concretely, we show that popular polytypic extensions of the functional programming language Haskell, namely, Generic Haskell and Scrap your Boilerplate have their genericity limited by data abstraction. We propose an extension to the Generic Haskell language where the `structure' in `structural polymorphism' is defined around the concept of interface and not the representation of a type.
Theory and Applications of Inverting Functions as Folds
"... This paper is devoted to the proof, applications, and generalisation of a theorem, due to Bird and de Moor, that gave conditions under which a total function can be expressed as a relational fold. The theorem is illustrated with three problems, all dealing with constructing trees with various proper ..."
Abstract

Cited by 1 (1 self)
 Add to MetaCart
(Show Context)
This paper is devoted to the proof, applications, and generalisation of a theorem, due to Bird and de Moor, that gave conditions under which a total function can be expressed as a relational fold. The theorem is illustrated with three problems, all dealing with constructing trees with various properties. It is then generalised to give conditions under which the inverse of a partial function can be expressed as a relational hylomorphism. The proof makes use of Doornbos and Backhouse's theory on wellfoundedness and reductivity. Possible applications of the generalised theorem is then discussed.
Sorting with Bialgebras and Distributive Laws
"... Sorting algorithms are an intrinsic part of functional programming folklore as they exemplify algorithm design using folds and unfolds. This has given rise to an informal notion of duality among sorting algorithms: insertion sorts are dual to selection sorts. Using bialgebras and distributive laws, ..."
Abstract

Cited by 1 (1 self)
 Add to MetaCart
Sorting algorithms are an intrinsic part of functional programming folklore as they exemplify algorithm design using folds and unfolds. This has given rise to an informal notion of duality among sorting algorithms: insertion sorts are dual to selection sorts. Using bialgebras and distributive laws, we formalise this notion within a categorical setting. We use types as a guiding force in exposing the recursive structure of bubble, insertion, selection, quick, tree, and heap sorts. Moreover, we show how to distill the computational essence of these algorithms down to onestep operations that are expressed as natural transformations. From this vantage point, the duality is clear, and one side of the algorithmic coin will neatly lead us to the other “for free”. As an optimisation, the approach is also extended to paramorphisms and apomorphisms, which allow for more efficient implementations of these algorithms than the corresponding folds and unfolds.
Relational Algebraic Ornaments
"... Dependently typed programming is hard, because ideally dependently typed programs should share structure with their correctness proofs, but there are very few guidelines on how one can arrive at such integrated programs. McBride’s algebraic ornamentation provides a methodological advancement, by w ..."
Abstract
 Add to MetaCart
(Show Context)
Dependently typed programming is hard, because ideally dependently typed programs should share structure with their correctness proofs, but there are very few guidelines on how one can arrive at such integrated programs. McBride’s algebraic ornamentation provides a methodological advancement, by which the programmer can derive a datatype from a specification involving a fold, such that a program that constructs elements of that datatype would be correct by construction. It is thus an effective method that leads the programmer from a specification to a dependently typed program. We enhance the applicability of this method by generalising algebraic ornamentation to a relational setting and bringing in relational algebraic methods, resulting in a hybrid approach that makes essential use of both dependently typed programming and relational program derivation. A dependently typed solution to the minimum coin change problem is presented as a demonstration of this hybrid approach. We also give a theoretically interesting “completeness theorem ” of relational algebraic ornaments, which sheds some light on the expressive power of ornaments and inductive families.
General Terms
"... In support of social interaction and information sharing, online communities commonly provide interfaces for users to form or interact with groups. For example, a user of the social music recommendation site last.fm might join the “First Wave Punk” group to discuss his or her favorite band (The Clas ..."
Abstract
 Add to MetaCart
(Show Context)
In support of social interaction and information sharing, online communities commonly provide interfaces for users to form or interact with groups. For example, a user of the social music recommendation site last.fm might join the “First Wave Punk” group to discuss his or her favorite band (The Clash) and listen to playlists generated by fellow fans. Clustering techniques provide the potential to automatically discover groups of users who appear to share interests. We explore this idea by describing algorithms for clustering users of an online community and automatically describing the resulting user groups. We designed these techniques for use in an online recommendation system with no preexisting group functionality, which led us to develop an “activitybalanced clustering ” algorithm that considers both user activity and user interests in forming clusters.
Under consideration for publication in J. Functional Programming 1 The Essence of the Iterator Pattern
"... The ITERATOR pattern gives a clean interface for elementbyelement access to a collection, independent of the collection’s shape. Imperative iterations using the pattern have two simultaneous aspects: mapping and accumulating. Various existing functional models of iteration capture one or other of ..."
Abstract
 Add to MetaCart
The ITERATOR pattern gives a clean interface for elementbyelement access to a collection, independent of the collection’s shape. Imperative iterations using the pattern have two simultaneous aspects: mapping and accumulating. Various existing functional models of iteration capture one or other of these aspects, but not both simultaneously. We argue that McBride and Paterson’s applicative functors, and in particular the corresponding traverse operator, do exactly this, and therefore capture the essence of the ITERATOR pattern. Moreover, they do so in a way that nicely supports modular programming. We present some axioms for traversal, discuss modularity concerns, and illustrate with a simple example, the wordcount problem. 1