Results 11  20
of
50
A Theory of Stack Allocation in Polymorphically Typed Languages
, 1993
"... We present a stackallocation scheme for the callbyvalue lambda calculus typed according to Milner's polymorphic type discipline. All the values a program produces, including function closures, are put into regions at runtime. Regions are allocated and deallocated in a stacklike manner. Region in ..."
Abstract

Cited by 24 (6 self)
 Add to MetaCart
We present a stackallocation scheme for the callbyvalue lambda calculus typed according to Milner's polymorphic type discipline. All the values a program produces, including function closures, are put into regions at runtime. Regions are allocated and deallocated in a stacklike manner. Region inference and effect inference is used to infer where regions can be allocated and deallocated. By allowing a limited form of polymorphic recursion in region types, the region inference is able to distinguish between the lifetimes of different invocations of a function, even when the function is recursive. The region analysis is eager in its attempt to reclaim memory as quickly as possible. The main result of this report is that region inference is safe, a result which entails that regions really can be deallocated, when region inference says they can. We give detailed proofs of this claim, which (in various forms) has been advanced several times in the literature. An algorithm for implementi...
Observers for Linear Types
 ESOP ’92: 4th European Symposium on Programming, Rennes, France, Proceedings
, 1992
"... Linear types provide the framework for a safe embedding of mutable state in functional languages by enforcing the principle that variables of linear type must be used exactly once. A potential disadvantage of this approach is that it places read accesses to suchvariables under the same restrictio ..."
Abstract

Cited by 22 (4 self)
 Add to MetaCart
Linear types provide the framework for a safe embedding of mutable state in functional languages by enforcing the principle that variables of linear type must be used exactly once. A potential disadvantage of this approach is that it places read accesses to suchvariables under the same restriction as write accesses, and thus prevents reads to proceed in parallel. We present here an extension of linear types which augments the usual distinction between linear and nonlinear bya third state, observers of linear variables. Since, unlike linear variables, observers can be duplicated, multiple concurrent reads are made possible. On the other hand, observers must be shortlived enough to never overlap with mutations. The resulting type system is in many aspects similar to the one of ML: It is polymorphic, has principal types, and admits a type reconstruction algorithm. 1 Introduction We are investigating a type system that addresses the update problem in functional languages: How...
Correctness of Monadic State: An Imperative CallbyNeed Calculus
 In Proc. 25th ACM Symposium on Principles of Programming Languages
, 1998
"... The extension of Haskell with a builtin state monad combines mathematical elegance with operational efficiency: ffl Semantically, at the source language level, constructs that act on the state are viewed as functions that pass an explicit store data structure around. ffl Operationally, at the imp ..."
Abstract

Cited by 20 (2 self)
 Add to MetaCart
The extension of Haskell with a builtin state monad combines mathematical elegance with operational efficiency: ffl Semantically, at the source language level, constructs that act on the state are viewed as functions that pass an explicit store data structure around. ffl Operationally, at the implementation level, constructs that act on the state are viewed as statements whose evaluation has the sideeffect of updating the implicit global store in place. There are several unproven conjectures that the two views are consistent. Recently, we have noted that the consistency of the two views is far from obvious: all it takes for the implementation to become unsound is one judiciouslyplaced betastep in the optimization phase of the compiler. This discovery motivates the current paper in which we formalize and show the correctness of the implementation of monadic state. For the proof, we first design a typed callbyneed language that models the intermediate language of the compiler, to...
Orderofevaluation Analysis for Destructive Updates in Strict Functional Languages with Flat Aggregates
 In Conference on Functional Programming Languages and Computer Architecture
, 1993
"... The aggregate update problem in functional languages is concerned with detecting cases where a functional array update operation can be implemented destructively in constant time. Previous work on this problem has assumed a fixed order of evaluation of expressions. In this paper, we devise a simple ..."
Abstract

Cited by 19 (1 self)
 Add to MetaCart
The aggregate update problem in functional languages is concerned with detecting cases where a functional array update operation can be implemented destructively in constant time. Previous work on this problem has assumed a fixed order of evaluation of expressions. In this paper, we devise a simple analysis, for strict functional languages with flat aggregates, that derives a good order of evaluation for making the updates destructive. Our work improves Hudak's work [14] on abstract reference counting, which assumes fixed order of evaluation and uses the domain of sticky reference counts. Our abstract reference counting uses a 2point domain. We show that for programs with no aliasing, our analysis is provably more precise than Hudak's approach (even if the fixed order of evaluation chosen by Hudak happens to be the right order). We also show that our analysis algorithm runs in polynomial time. To the best of our knowledge, no previous work shows polynomial time complexity. We suggest ...
Linearity and Laziness
 In Proc. 5th ACM Conference on Functional Programming Languages and Computer
, 1990
"... A criticism often levelled at functional languages is that they do not cope elegantly or efficiently with problems involving changes of state. In a recent paper [26], Wadler has proposed a new approach to these problems. His proposal involves the use of a type system based on the linear logic of Gir ..."
Abstract

Cited by 17 (1 self)
 Add to MetaCart
A criticism often levelled at functional languages is that they do not cope elegantly or efficiently with problems involving changes of state. In a recent paper [26], Wadler has proposed a new approach to these problems. His proposal involves the use of a type system based on the linear logic of Girard [7]. This allows the programmer to specify the "natural" imperative operations without at the same time sacrificing the crucial property of referential transparency. In this paper we investigate the practicality of Wadler's approach, describing the design and implementation of a variant of Lazy ML [2]. A small example program shows how imperative operations can be used in a referentially transparent way, and at the same time it highlights some of the problems with the approach. Our implementation is based on a variant of the Gmachine [15, 1]. We give some benchmark figures to compare the performance of our machine with the original one. The results are disappointing: the cost of maintai...
Purely Functional RandomAccess Lists
 In Functional Programming Languages and Computer Architecture
, 1995
"... We present a new data structure, called a randomaccess list, that supports array lookup and update operations in O(log n) time, while simultaneously providing O(1) time list operations (cons, head, tail). A closer analysis of the array operations improves the bound to O(minfi; log ng) in the wor ..."
Abstract

Cited by 17 (2 self)
 Add to MetaCart
We present a new data structure, called a randomaccess list, that supports array lookup and update operations in O(log n) time, while simultaneously providing O(1) time list operations (cons, head, tail). A closer analysis of the array operations improves the bound to O(minfi; log ng) in the worst case and O(log i) in the expected case, where i is the index of the desired element. Empirical evidence suggests that this data structure should be quite efficient in practice. 1 Introduction Lists are the primary data structure in every functional programmer 's toolbox. They are simple, convenient, and usually quite efficient. The main drawback of lists is that accessing the ith element requires O(i) time. In such situations, functional programmers often find themselves longing for the efficient random access of arrays. Unfortunately, arrays can be quite awkward to implement in a functional setting, where previous versions of the array must be available even after an update. Since arra...
Mutable abstract datatypes  or  how to have your state and munge it too
, 1992
"... 1 Introduction It's been said many times before: "Functional languages are great, but they can't deal with state! " to which functional programmers often reply: "But a compiler that's great, will eliminate state!" Although recent advances in compiler optimization techniques have ..."
Abstract

Cited by 15 (3 self)
 Add to MetaCart
1 Introduction It's been said many times before: "Functional languages are great, but they can't deal with state! " to which functional programmers often reply: "But a compiler that's great, will eliminate state!" Although recent advances in compiler optimization techniques have eliminated many concerns over efficiency, optimizations have their own set of problems: (1) they are often expensive (in terms of compilation resources), (2) they aren't always good enough, (3) they are often hard to reason about, and (4) they are implementation dependent (and thus programs that depend on them are not portable). Perhaps more importantly, compiler optimizations aren't explicit, and in this sense are not "expressive " enough.
RML  A New Language and Implementation for Natural Semantics
 PROCEEDINGS OF THE 6TH INTERNATIONAL SYMPOSIUM ON PROGRAMMING LANGUAGE IMPLEMENTATION AND LOGIC PROGRAMMING, PLILP, VOLUME 884 OF LNCS
, 1994
"... RML is a programming language intended for the implementation of Natural Semantics specifications. The basic procedural elements are relations: manytomany mappings defined by a number of axioms or inference rules. It has control flow, logical variables and (explicit) unification as in Prolog; from ..."
Abstract

Cited by 15 (2 self)
 Add to MetaCart
RML is a programming language intended for the implementation of Natural Semantics specifications. The basic procedural elements are relations: manytomany mappings defined by a number of axioms or inference rules. It has control flow, logical variables and (explicit) unification as in Prolog; from ML it borrows a polymorphic type system, data structures, and pattern matching; a facility for separatelycompilable modules also exists. A simple prototype compiler, based on translating RML to ContinuationPassing Style and then to C, has been implemented. Benchmarks indicate that this compiler generates code that is several orders of magnitude faster than Typol, and two times faster than standard Prolog compilers.
A New Array Operation
 Graph Reduction: Proceedings of a Workshop
, 1986
"... This paper proposes a new solution, which is a variant on the "monolothic" approach to array operations. The new solution is also not completely satisfactory, but does have advantages complementary to other proposals. It makes a class of programs easy to express, notably those involving the construc ..."
Abstract

Cited by 15 (0 self)
 Add to MetaCart
This paper proposes a new solution, which is a variant on the "monolothic" approach to array operations. The new solution is also not completely satisfactory, but does have advantages complementary to other proposals. It makes a class of programs easy to express, notably those involving the construction of histograms. It also allows for parallel implementations without the need to introduce nondeterminism. The work reported here was motivated by discussions at the Workshop on Graph Reduction, of which this is the proceedings. In particular, it was motivated by the contributions of Arvind and Paul Hudak (see this volume), and especially Arvind's observation that the histogram problem is difficult to solve in a satisfactory way. After the first draft of this paper was written, I discovered that Simon Peyton Jones independently suggested the same idea, also prompted by one of Arvind's talks. After the second draft was written, I discovered that Guy Steele and Daniel Hillis use a very similar notion in Connection Machine Lisp [SH86]. Apparently the simple innovation described in this paper is an idea whose time has come. This paper is organized as follows. Section 1 briefly surveys previously proposed array operations. Section 2 introduces the new operation. Section 3 gives a small example of its use. Section 4 discusses two variations on the array operation. Section 5 concludes. 1 Background
The Role of Lazy Evaluation in Amortized Data Structures
 In Proc. of the International Conference on Functional Programming
, 1996
"... Traditional techniques for designing and analyzing amortized data structures in an imperative setting are of limited use in a functional setting because they apply only to singlethreaded data structures, yet functional data structures can be nonsinglethreaded. In earlier work, we showed how lazy e ..."
Abstract

Cited by 13 (2 self)
 Add to MetaCart
Traditional techniques for designing and analyzing amortized data structures in an imperative setting are of limited use in a functional setting because they apply only to singlethreaded data structures, yet functional data structures can be nonsinglethreaded. In earlier work, we showed how lazy evaluation supports functional amortized data structures and described a technique (the banker's method) for analyzing such data structures. In this paper, we present a new analysis technique (the physicist's method) and show how one can sometimes derive a worstcase data structure from an amortized data structure by appropriately scheduling the premature execution of delayed components. We use these techniques to develop new implementations of FIFO queues and binomial queues. 1 Introduction Functional programmers have long debated the relative merits of strict versus lazy evaluation. Although lazy evaluation has many benefits [11], strict evaluation is clearly superior in at least one area:...