Results 1 -
4 of
4
Manufacturing Datatypes
, 1999
"... This paper describes a general framework for designing purely functional datatypes that automatically satisfy given size or structural constraints. Using the framework we develop implementations of different matrix types (eg square matrices) and implementations of several tree types (eg Braun trees, ..."
Abstract
-
Cited by 22 (3 self)
- Add to MetaCart
This paper describes a general framework for designing purely functional datatypes that automatically satisfy given size or structural constraints. Using the framework we develop implementations of different matrix types (eg square matrices) and implementations of several tree types (eg Braun trees, 2-3 trees). Consider, for instance, representing square n \Theta n matrices. The usual representation using lists of lists fails to meet the structural constraints: there is no way to ensure that the outer list and the inner lists have the same length. The main idea of our approach is to solve in a first step a related, but simpler problem, namely to generate the multiset of all square numbers. In order to describe this multiset we employ recursion equations involving finite multisets, multiset union, addition and multiplication lifted to multisets. In a second step we mechanically derive datatype definitions from these recursion equations which enforce the `squareness' constraint. The tra...
Numerical Representations as Higher-Order Nested Datatypes
, 1998
"... Number systems serve admirably as templates for container types: a container object of size n is modelled after the representation of the number n and operations on container objects are modelled after their number-theoretic counterparts. Binomial queues are probably the first data structure that wa ..."
Abstract
-
Cited by 5 (2 self)
- Add to MetaCart
Number systems serve admirably as templates for container types: a container object of size n is modelled after the representation of the number n and operations on container objects are modelled after their number-theoretic counterparts. Binomial queues are probably the first data structure that was designed with this analogy in mind. In this paper we show how to express these so-called numerical representations as higher-order nested datatypes. A nested datatype allows to capture the structural invariants of a numerical representation, so that the violation of an invariant can be detected at compile-time. We develop a programming method which allows to adapt algorithms to the new representation in a mostly straightforward manner. The framework is employed to implement three different container types: binary random-access lists, binomial queues, and 2-3 finger search trees. The latter data structure, which is treated in some depth, can be seen as the main innovation from a data-struct...
Polymorphic Typing of Heterogeneous Lists
"... ion and concretization operator from pattern list type to uniform ML list type The abstraction AbsML that maps every pattern list type scheme to a set of standard ML type scheme results from the definition of the concretization and the ordering vP on pattern list types. Property 2. The abstraction ..."
Abstract
- Add to MetaCart
ion and concretization operator from pattern list type to uniform ML list type The abstraction AbsML that maps every pattern list type scheme to a set of standard ML type scheme results from the definition of the concretization and the ordering vP on pattern list types. Property 2. The abstraction and concretization functions (AbsML ; ConcML ) define a lower approximation. ae ` E ) øML list ae ` null(E1) ) bool ae ` E1 ) øML ae ` E2 ) øML list ae ` E1 :: E2 ) øML list ae ` E ) øML list ae ` head(E) ) øML ae ` E1 ) øML list ae ` tail(E1) ) øML list Figure 8: Standard ML list operator behavior For example the abstraction of the pattern list type (ff ! ff)(ff ! num)(!) list of the list x:x :: x:0 :: [] is: (ff ! num) list. With respect to the abstraction and concretization functions (AbsML ; ConcML ), we derive the set of rules describing the behavior of list operators on ML-types--- listed on figure 8---from the set of rules describing the behavior of list operators on patter...
Perfect Trees and Bit-Reversal Permutations
, 1999
"... A famous algorithm is the Fast Fourier Transform, or FFT. An ecient iterative version of the FFT algorithm performs as a rst step a bit-reversal permutation of the input list. The bit-reversal permutation swaps elements whose indices have binary representations that are the reverse of each other. U ..."
Abstract
- Add to MetaCart
A famous algorithm is the Fast Fourier Transform, or FFT. An ecient iterative version of the FFT algorithm performs as a rst step a bit-reversal permutation of the input list. The bit-reversal permutation swaps elements whose indices have binary representations that are the reverse of each other. Using an amortized approach this operation can be made to run in linear time on a random-access machine. An intriguing question is whether a linear-time implementation is also feasible on a pointer machine, that is in a purely functional setting. We show that the answer to this question is in the armative. In deriving a solution we employ several advanced programming language concepts such as nested datatypes, associated fold and unfold operators, rank-2 types, and polymorphic recursion.

