Results 1 -
3 of
3
A New Method for Functional Arrays
- Journal of Functional Programming
, 1997
"... Arrays are probably the most widely used data structure in imperative programming languages, yet functional languages typically only support arrays in a limited manner, or prohibit them entirely. This is not too surprising, since most other mutable data structures, such as trees, have elegant immuta ..."
Abstract
-
Cited by 13 (0 self)
- Add to MetaCart
Arrays are probably the most widely used data structure in imperative programming languages, yet functional languages typically only support arrays in a limited manner, or prohibit them entirely. This is not too surprising, since most other mutable data structures, such as trees, have elegant immutable analogues in the functional world, whereas arrays do not. Previous attempts at addressing the problem have suffered from one of three weaknesses, either that they don't support arrays as a persistent data structure (unlike the functional analogues of other imperative data structures), or that the range of operations is too restrictive to support some common array algorithms efficiently, or that they have performance problems. Our technique provides arrays as a true functional analogue of imperative arrays with the properties that functional programmers have come to expect from their data structures. To efficiently support array algorithms from the imperative world, we provide O(1) operations for single-threaded array use. Fully persistent array use can also be provided at O(1) amortized cost, provided that the algorithm satisfies a simple requirement as to uniformity of access. For those algorithms which do not access the array uniformly or single-threadedly, array reads or updates take at most O(log n) amortized time, where n is the size of the array. Experimental results indicate that the overheads of our technique are acceptable in practice for many applications.
Refining First-Class Stores
- In Proceedings of the ACM SIGPLAN Workshop on State in Programming Languages
, 1993
"... A first-class store is an object that captures the values of mutable objects at a particular time in a program's execution. First-class stores allow programmers to cleanly, safely, and efficiently implement "undo" and "redo" operations on mutable objects. This paper describes a generalized interface ..."
Abstract
-
Cited by 7 (2 self)
- Add to MetaCart
A first-class store is an object that captures the values of mutable objects at a particular time in a program's execution. First-class stores allow programmers to cleanly, safely, and efficiently implement "undo" and "redo" operations on mutable objects. This paper describes a generalized interface for first-class stores that allows the programmer to partition mutable data and refine the scope of store objects. We demonstrate the power of the interface by discussing three applications: version arrays, replay debugging, and nested transactions. A denotational semantics for first-class stores is given and two implementations are discussed. 1 Introduction First-class continuations provide programmers with the ability to manipulate the control of their program in many flexible ways. Operationally, we can think of capturing the current continuation as capturing the current program counter and lexical environment of a program and binding it to a variable. Similarly, invoking a continuation...
Fully Persistent Arrays for Efficient Incremental Updates and Voluminous Reads
- 4th European Symposium on Programming
, 1992
"... The array update problem in a purely functional language is the following: once an array is updated, both the original array and the newly updated one must be preserved to maintain referential transparency. We devise a very simple, fully persistent data structure to tackle this problem such that ..."
Abstract
-
Cited by 5 (2 self)
- Add to MetaCart
The array update problem in a purely functional language is the following: once an array is updated, both the original array and the newly updated one must be preserved to maintain referential transparency. We devise a very simple, fully persistent data structure to tackle this problem such that ffl each incremental update costs O(1) worst--case time, ffl a voluminous sequence of r reads cost in total O(r) amortized time, and ffl the data structure use O(n + u) space, where n is the size of the array and u is the total number of updates. A sequence of r reads is voluminous if r is \Omega\Gamma n) and the sequence of arrays being read forms a path of length O(r) in the version tree. A voluminous sequence of reads may be mixed with updates without affecting either the performance of reads or updates. An immediate consequence of the above result is that if a functional program is single--threaded, then the data structure provides a simple and efficient implementation of funct...

