Results 1 -
3 of
3
A Semantics for Shape
- Science of Computer Programming
, 1995
"... Shapely types separate data, represented by lists, from shape, or structure. This separation supports shape polymorphism, where operations are defined for arbitrary shapes, and shapely operations, for which the shape of the result is determined by that of the input, permitting static shape checking. ..."
Abstract
-
Cited by 57 (18 self)
- Add to MetaCart
Shapely types separate data, represented by lists, from shape, or structure. This separation supports shape polymorphism, where operations are defined for arbitrary shapes, and shapely operations, for which the shape of the result is determined by that of the input, permitting static shape checking. The shapely types are closed under the formation of fixpoints, and hence include the usual algebraic types of lists, trees, etc. They also include other standard data structures such as arrays, graphs and records. 1 Introduction The values of a shapely type are uniquely determined by their shape and their data. The shape can be thought of as a structure with holes or positions, into which data elements (stored in a list) can be inserted. The use of shape in computing is widespread, but till now it has not, apparently, been the subject of independent study. The body of the paper presents a semantics for shape, based on elementary ideas from category theory. First, let us consider some examp...
Shapely Types and Shape Polymorphism
- Programming Languages and Systems - ESOP '94: 5th European Symposium on Programming
, 1994
"... . Shapely types separate data, represented by lists, from shape, or structure. This separation supports shape polymorphism, where operations are defined for arbitrary shapes, and shapely operations, for which the shape of the result is determined by that of the input, permitting static shape checkin ..."
Abstract
-
Cited by 32 (6 self)
- Add to MetaCart
. Shapely types separate data, represented by lists, from shape, or structure. This separation supports shape polymorphism, where operations are defined for arbitrary shapes, and shapely operations, for which the shape of the result is determined by that of the input, permitting static shape checking. They include both arrays and the usual algebraic types (of trees, graphs, etc.), and are closed under the formation of initial algebras. 1 Introduction Consider the operation map which applies a function to each element of a list. In existing functional languages, its type is (ff!fi)!ff list!fi list where ff and fi may range over any types. This data polymorphism allows the data (ff and fi) to vary, but uses a fixed shape, list. Shape polymorphism fixes the data, but allows the shape to vary, so that, for types A and B, instances of map include (A!B)!A tree!B tree and (A!B)!A matrix!B matrix In each case map(f) applies f to the data (the leaves or entries), while leaving the shape fi...
Matrices, Monads and the Fast Fourier Transform
- Proceedings of the
, 1993
"... This paper presents a formal semantics for vectors and matrices, suitable for static type-checking. This is not available in apl, which produces run-time type errors, or in the usual functional languages, where matrices are typically implemented by lists of lists. Here, a matrix is a vector of vecto ..."
Abstract
-
Cited by 2 (1 self)
- Add to MetaCart
This paper presents a formal semantics for vectors and matrices, suitable for static type-checking. This is not available in apl, which produces run-time type errors, or in the usual functional languages, where matrices are typically implemented by lists of lists. Here, a matrix is a vector of vectors. Vectors are distinguished from lists by requiring that vector computations determine the length of the result from that of the argument, without reference to values. This leads to a two-level semantics, with values above and shapes below. Each operation must then specify its action on shapes as well as its action on values. Vectors and matrices inherit much of their structure from lists. In particular, the monadic structure given by singleton lists and the flattening of lists of lists extends in this way. Some new constructions, such as transposition of matrices, have no list counterpart. The power of this calculus for vector and matrix algebra is sufficient to represent the discrete Fou...

