Results 1 
5 of
5
Rules and Strategies for Transforming Functional and Logic Programs
 ACM Computing Surveys
, 1996
"... We present an overview of the program transformation methodology, focusing our attention on the socalled `rules + strategies' approach in the case of functional and logic programs. The paper is intended to offer an introduction to the subject. The various techniques we present are illustrated via s ..."
Abstract

Cited by 76 (4 self)
 Add to MetaCart
We present an overview of the program transformation methodology, focusing our attention on the socalled `rules + strategies' approach in the case of functional and logic programs. The paper is intended to offer an introduction to the subject. The various techniques we present are illustrated via simple examples. A preliminary version of this report has been published in: Moller, B., Partsch, H., and Schuman, S. (eds.): Formal Program Development. Lecture Notes in Computer Science 755, Springer Verlag (1993) 263304. Also published in: ACM Computing Surveys, Vol 28, No. 2, June 1996. 3 1 Introduction The program transformation approach to the development of programs has first been advocated by [BurstallDarlington 77], although the basic ideas were already presented in previous papers by the same authors [Darlington 72, BurstallDarlington 75]. In that approach the task of writing a correct and efficient program is realized in two phases: the first phase consists in writing an in...
Using Circular Programs to Deforest in Accumulating Parameters
, 2002
"... Functional languages allow a modular programming style by function composition, which however can lead to inefficient runtime behavior due to production and consumption of intermediate results. We present a new mechanizable transformation technique for removing intermediate data structures in the co ..."
Abstract

Cited by 14 (4 self)
 Add to MetaCart
Functional languages allow a modular programming style by function composition, which however can lead to inefficient runtime behavior due to production and consumption of intermediate results. We present a new mechanizable transformation technique for removing intermediate data structures in the composition of two functions from a class of recursive functions with accumulating parameters, for which classical deforestation techniques fail. In order to avoid multiple traversals of the input data structure, the composition algorithm produces circular programs that make essential use of lazy evaluation and local recursion. The resulting programs are simplified using a postprocessing phase presented in the paper.
An Exercise in Polytypic Program Derivation: repmin
, 1996
"... A program derivation is said to be polytypic if some of its parameters are data types. The repmin problem is to replace all elements of a tree of numbers by the minimum element, making only a single pass over the original tree. Here we present a polytypic derivation for that problem. The derivation ..."
Abstract

Cited by 3 (0 self)
 Add to MetaCart
A program derivation is said to be polytypic if some of its parameters are data types. The repmin problem is to replace all elements of a tree of numbers by the minimum element, making only a single pass over the original tree. Here we present a polytypic derivation for that problem. The derivation has an unusual feature: when interpreted in the category of relations, the resulting program is the wellknown cyclic logic program, and when interpreted in the category of functions, it is the wellknown higherorder functional solution. 1 Motivation Suppose I were to show you a derivation of a shortest path algorithm, and my whole presentation was in terms of numbers, addition and minimum. Undoubtedly some of you would get up and point out that by abstracting over the operations and recording their algebraic properties, I could have derived a whole class of algorithms instead of one particular program. Indeed, such abstraction over operations is now commonly accepted as one of the hallmar...
Program Transformation in MartinLöf's Type Theory
, 1994
"... ion This rule allows the introduction of a new equation from an existing one, by means of the introduction of a local definition in terms of a where clause. If e 1 ' e 2 is an equation with e 2 containing the subexpression a, then the following equation can be derived: e 1 ' e 2 [a / u] where u = a ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
ion This rule allows the introduction of a new equation from an existing one, by means of the introduction of a local definition in terms of a where clause. If e 1 ' e 2 is an equation with e 2 containing the subexpression a, then the following equation can be derived: e 1 ' e 2 [a / u] where u = a, where in e 2 the subexpression a has been replaced by the variable u and abstracted in a where clause. As MTS does not provide local definitions in expressions where clauses will be represented by the expressions they abbreviate. An expression of the form e where u = a is really an abbreviation for ((u:e) a). So, given an equation e 1 ' e 2 , if its rhs e 2 can be seen as a function e applied to an object a, then the corresponding abstraction of the subexpression a was found. Hence, Abstraction can be defined by the rule: e 2 A ! B a 2 A h 1 2 e 1 'B e 2 h 2 2 e 2 'B apply(e; a) abstr (h 1 ; h 2 ) 2 e 1 'B apply(e; a) that is a simple application of transitivity (trans) of equality: ...
Bidirectionalization for free! (Perl)
, 2009
"... A bidirectional transformation consists of a function get that takes a source (document or value) to a view and a function put that takes an updated view and the original source back to an updated source, governed by certain consistency conditions relating the two functions. Both the database and pr ..."
Abstract
 Add to MetaCart
A bidirectional transformation consists of a function get that takes a source (document or value) to a view and a function put that takes an updated view and the original source back to an updated source, governed by certain consistency conditions relating the two functions. Both the database and programming language communities have studied techniques that essentially allow a user to specify only one of get and put and have the other inferred automatically. All approaches so far to this bidirectionalization task have been syntactic in nature, either proposing a domainspecific language with limited expressiveness but builtin (and composable) backward components, or restricting get to a simple syntactic form from which some algorithm can synthesize an appropriate definition for put. Here we present a semantic approach instead. The idea is to take a generalpurpose language, Haskell, and write a higherorder function that takes (polymorphic) getfunctions as arguments and returns appropriate putfunctions. All this on the level of semantic values, without being willing, or even able, to inspect the definition of get, and thus liberated from syntactic restraints. Our solution is inspired by relational parametricity and uses free theorems for proving the consistency conditions. It works beautifully.