Results 1 - 10
of
10
How to Declare an Imperative
, 1995
"... How canweintegrate interaction into a purely declarative language? This tutorial describes a solution to this problem based on a monad. The solution has been implemented in the functional language Haskell and the declarative language Escher. Comparisons are given to other approaches to interaction b ..."
Abstract
-
Cited by 94 (3 self)
- Add to MetaCart
How canweintegrate interaction into a purely declarative language? This tutorial describes a solution to this problem based on a monad. The solution has been implemented in the functional language Haskell and the declarative language Escher. Comparisons are given to other approaches to interaction based on synchronous streams, continuations, linear logic, and side effects.
A Type System for Bounded Space and Functional in-Place Update
, 2000
"... We show how linear typing can be used to obtain functional programs which modify heap-allocated data structures in place. We present this both as a "design pattern" for writing C-code in a functional style and as a compilation process from linearly typed first-order functional programs into malloc() ..."
Abstract
-
Cited by 79 (15 self)
- Add to MetaCart
We show how linear typing can be used to obtain functional programs which modify heap-allocated data structures in place. We present this both as a "design pattern" for writing C-code in a functional style and as a compilation process from linearly typed first-order functional programs into malloc()-free C code. The main technical result is the correctness of this compilation. The crucial innovation over previous linear typing schemes consists of the introduction of a resource type # which controls the number of constructor symbols such as cons in recursive definitions and ensures linear space while restricting expressive power surprisingly little. While the space e#ciency brought about by the new typing scheme and the compilation into C can also be realised by with state-of-the-art optimising compilers for functional languages such as Ocaml [16], the present method provides guaranteed bounds on heap space which will be of use for applications such as languages for embedd...
Recycling Continuations
, 1998
"... If the continuations in functional data-structure-generating programs are made explicit and represented as records, they can be #recycled." Once they have served their purpose as temporary, intermediate structures for managing program control, the space they occupy can be reused for the structures t ..."
Abstract
-
Cited by 40 (1 self)
- Add to MetaCart
If the continuations in functional data-structure-generating programs are made explicit and represented as records, they can be #recycled." Once they have served their purpose as temporary, intermediate structures for managing program control, the space they occupy can be reused for the structures that the programs produce as their output. To effect this immediate memory reclamation, we use a sequence of correctness-preserving program transformations, demonstrated through a series of simple examples. We then apply the transformations to general anamorphism operators, with the important consequence that all #nite-output anamorphisms can now be run without anystack- or continuationspace overhead. 1 Introduction The runtime architecture for a language implementation keeps track of the continuations of procedure calls using either a stack of call frames or a linked chain of heapallocated continuation structures. One advantage that may be claimed for the stack approach is that deallocatio...
On Regions and Linear Types
"... We explore how two different mechanisms for reasoning about state, linear typing and the type, region and effect discipline, complement one another in the design of a strongly typed functional programming language. The basis for our language is a simple lambda calculus containing first-class regions ..."
Abstract
-
Cited by 32 (2 self)
- Add to MetaCart
We explore how two different mechanisms for reasoning about state, linear typing and the type, region and effect discipline, complement one another in the design of a strongly typed functional programming language. The basis for our language is a simple lambda calculus containing first-class regions, which are explicitly passed as arguments to functions, returned as results and stored in user-defined data structures. In order to ensure appropriate memory safety properties, we draw upon the literature on linear type systems to help control access to and deallocation of regions. In fact, we use two different interpretations of linear types, one in which multiple-use values are freely copied and discarded and one in which multiple-use values are explicitly reference-counted, and show that both interpretations give rise to interesting invariants for manipulating regions. We also explore new programming paradigms that arise by mixing first-class regions and conventional linear data stru...
Variations on Algebra: monadicity and generalisations of equational theories
- Formal Aspects of Computing
, 2001
"... this paper the author was partially supported by an SERC/EPSRC Advanced Research Fellowship, EPSRC Research grant GR/L54639, and EU Working Group APPSEM ..."
Abstract
-
Cited by 26 (0 self)
- Add to MetaCart
this paper the author was partially supported by an SERC/EPSRC Advanced Research Fellowship, EPSRC Research grant GR/L54639, and EU Working Group APPSEM
Programming with Variable Functions
- In Proceedings of the 1998 ACM SIGPLAN International Conference on Functional Programming
, 1998
"... What is a good method to specify and derive imperative programs? This paper argues that a new form of functional programming fits the bill, where variable functions can be updated at specified points in their domain. Traditional algebraic specification and functional programming are a powerful pair ..."
Abstract
-
Cited by 7 (0 self)
- Add to MetaCart
What is a good method to specify and derive imperative programs? This paper argues that a new form of functional programming fits the bill, where variable functions can be updated at specified points in their domain. Traditional algebraic specification and functional programming are a powerful pair of tools for specifying and implementing domains of discourse and operations on them. Recent work on evolving algebras has introduced the function update in algebraic specifications, and has applied it with good success in the modelling of reactive systems. We show that similar concepts allow one to derive efficient programs in a systematic way from functional specifications. The final outcome of such a derivation can be made as efficient as a traditional imperative program with pointers, but can still be reasoned about at a high level. Variable functions can also play an important role in the structuring of large systems. They can subsume object-oriented programming languages, without incu...
Alias Killing: Unique Variables Without Destructive Reads
- In [25
, 1999
"... An unshared object can be accessed without regard to possible conflicts with other parts of a system, whether concurrent or single-threaded. A unique variable (sometimes known as a "free" or "linear" variable) is one that either is null or else refers to an unshared object. Being able to declare and ..."
Abstract
-
Cited by 4 (0 self)
- Add to MetaCart
An unshared object can be accessed without regard to possible conflicts with other parts of a system, whether concurrent or single-threaded. A unique variable (sometimes known as a "free" or "linear" variable) is one that either is null or else refers to an unshared object. Being able to declare and check which variables are unique improves a programmer 's ability to avoid program faults.
In-place update with linear types or How to compile functional programs into malloc()-free C
"... this paper is to show that by imposing mild extra annotations one can have the best of both worlds: easy to write code which is amenable to equational reasoning, yet modifies its arguments in place and does not allocate heap space unless explicitly told to do so. An aside: a critic may argue that a ..."
Abstract
-
Cited by 3 (0 self)
- Add to MetaCart
this paper is to show that by imposing mild extra annotations one can have the best of both worlds: easy to write code which is amenable to equational reasoning, yet modifies its arguments in place and does not allocate heap space unless explicitly told to do so. An aside: a critic may argue that a skilled programmer would write the corresponding C code in the same time if not faster than the functional code. I would like to compare this with doing lengthy arithmetic or algebraic calculations with pencil and paper as opposed to using a pocket calculator or a computer algebra system. Although some individuals develop considerable skill at the former activity and may enjoy developing ingenious shortcuts here and there one must agree that this will invariably distract the mind from more creative tasks. (end of aside.) The main idea of the proposed approach is that the programmer should pay for the use of constructor functions like cons(), node(), etc., as these require the allocation of heap space. This is done by introducing a special type 3 or dia t pointing to free heap space of appropriate size to store one list or tree node. When invoking a recursive constructor function such as cons()
Abstraction and Performance from Explicit Monadic Reflection
, 1999
"... Much of the monadic programming literature gets the types right but the abstraction wrong. Using monadic parsing as the motivating example, we demonstrate standard monadic programs in Scheme, recognize how they violate abstraction boundaries, and recover clean abstraction crossings through monadic r ..."
Abstract
-
Cited by 1 (0 self)
- Add to MetaCart
Much of the monadic programming literature gets the types right but the abstraction wrong. Using monadic parsing as the motivating example, we demonstrate standard monadic programs in Scheme, recognize how they violate abstraction boundaries, and recover clean abstraction crossings through monadic reflection. Once monadic reflection is made explicit, it is possible to construct a grammar for monadic programming. This grammar, in turn, enables the redefinition of the monadic operators as macros that eliminate at expansion time the overhead imposed by functional representations. The result is very efficient monadic programs; for parsing, the output code is competitive with good handcrafted parsers.
Out-of-core Functional Programming with Type-based Primitives
- In Proceedings of the 2nd International Workshop on Practical Aspects of Declarative Languages
, 2000
"... . We formulate and experiment with type-based primitives (such as fold and unfold operations) for out-of-core processing of functional data structures. We follow the view that recursive data types are fixed points of polynomial type constructors. This view leads to a clear separation of the sema ..."
Abstract
-
Cited by 1 (0 self)
- Add to MetaCart
. We formulate and experiment with type-based primitives (such as fold and unfold operations) for out-of-core processing of functional data structures. We follow the view that recursive data types are fixed points of polynomial type constructors. This view leads to a clear separation of the semantics and the implementations of recursive data types. We provide monadic implementations of the type-based primitives so that the intermediate data structures used for the executions of the primitives can be placed in out-of-core storage. The parametric module facility of Objective Caml is further used to package the out-of-core implementations. The resulting out-of-core user code retains the same program structure of the in-core user code and can be as elegant. 1 Motivation In programming languages supporting automatic memory management, a program need not explicitly request storage for data during the execution. The run-time system allocates space for new data, and reclaims space ...

