## The Zip Calculus (2000)

Venue: | In Fifth International Conference on Mathematics of Program Construction (MPC 2000 |

Citations: | 7 - 0 self |

### BibTeX

@INPROCEEDINGS{Tullsen00thezip,

author = {Mark Tullsen},

title = {The Zip Calculus},

booktitle = {In Fifth International Conference on Mathematics of Program Construction (MPC 2000},

year = {2000},

pages = {28--44},

publisher = {Springer-Verlag}

}

### OpenURL

### Abstract

. Many have recognized the need for genericity in programming and program transformation. Genericity over data types has been achieved with polymorphism. Genericity over type constructors, often called polytypism, is an area of active research. This paper proposes that another kind of genericity is needed: genericity over the length of tuples. Untyped languages allow for such genericity but typed languages do not (except for languages allowing dependent types). The contribution of this paper is to present the zip calculus, a typed lambda calculus that provides genericity over the length of tuples and yet does not require the full generality of dependent types. 1 Introduction The key to writing robust software is abstraction, but genericity is often needed to use abstraction: to write a generic sort routine, genericity over types is needed (i.e., polymorphism); to write a generic fold (or catamorphism, a function inductively dened over an inductive data structure), genericity over t...

### Citations

518 | Lambda calculi with types
- Barendregt
- 1992
(Show Context)
Citation Context ...us allows one to do this. 3 The Zip Calculus The zip calculus is a typed lambda calculus extended with n-tuples and sums. In particular, it starts as F!though in the form of a Pure Type System (PTS) [=-=2, 15]-=-. To this is added a construct for n-tuples and then n-sums are added (very simply using n-tuples). As the syntax of terms and types was becoming very close (because tuples exist at the type level), t... |

329 | Theorems for free
- Wadler
- 1989
(Show Context)
Citation Context ...p7 functions is not hard but tedious. It is clearly desirable to abstract over these and write one generic zip, one generic zipWith, and one generic unzip. 2.2 More General Laws Note the free theorem =-=-=-[18] for zip: map(cross(f,g))szip = zipscross(map f,map g) where cross (f,g) (x,y) = (f x,g y) (Note that is used for function composition; map f applies f to each element of a list.) The comparable ... |

298 | Functional programming with bananas, lenses, envelopes and barbed wire
- Meijer, Fokkinga, et al.
- 1991
(Show Context)
Citation Context ...not only program size, but also the number of laws and the length of program derivations. Consequently, the program transformation communitynotably the BirdMeertens Formalism (or Squiggol) community [=-=3, 12, 1-=-3]has been working to make programs more generic: not just polymorphic, but polytypic [811]. However, the genericity provided by polymorphism and polytypism is still not adequate to achieve certain ab... |

216 | Cayenne–a language with dependent types
- Augustsson
- 1998
(Show Context)
Citation Context ...ollowing: First, one can forgo typed languages and use an untyped language to achieve this level of genericity: e.g., in Lisp a list can be used as an n-tuple. Second, a language with dependent types =-=[1]-=- could encode n-tuples (and much more); though the disadvantages are that type checking is undecidable (not to mention the lack of type inference) and the types are more complex. However, the zip calc... |

174 | PolyP – a polytypic programming language extension
- Jansson, Jeuring
- 1997
(Show Context)
Citation Context ... curry. Extending the zip calculus to type this generic curry is an area for future research. 5.2 Relation to Other Work Polytypic programming [10, 11, 13] has similar goals to this work (e.g., PolyP =-=[8]-=- and Functorial ML [9]). However, as just noted, the genericity of polytypism and n-tuples appear orthogonal. As seen in section 4.5, with both polytypism and n-tuples some very generic programs and l... |

147 |
Proving and applying program transformations expressed with second-order patterns
- Huet, Lang
- 1978
(Show Context)
Citation Context ... 8n:8isn:P(#i) (using ML syntax for projections where #1 = fst, #2 = snd). However, a meta-language is now needed to express program laws. A simpler approach to transformation, the schematic approach =-=-=-[7], avoids the use of a metalanguage: program laws are of the form e 1 = e 2 ( e 3 = e 4 (e 1 ; e 2 ; e 3 ; e 4 are programs in the language, all free variables are implicitly universally quantied, ... |

138 |
Corrigendum : Complete type inference for simple object
- Wand
- 1988
(Show Context)
Citation Context ...e) 3d); to allow for projections that are polymorphic over dimensions (e.g., projection 1 could be applied to a tuple of any size) would take the zip calculus into the realm of extensible records [4, =-=14, 19]-=-. N-tuples and extensible records seem to be orthogonal issues, though further investigation is required. Related also is Hoogendijk's thesis [5] in which he develops a notation for n-tuple valued fun... |

105 |
Data structures and program transformation
- Malcolm
- 1990
(Show Context)
Citation Context ...-tuple reduce} = h l m:l i {n-tuple eta} = m {n-tuple eta} 4.5 Generic Catamorphisms It was obvious that Haskell's zip family of functions could benet from n-tuples; but interestingly, catamorphisms [=-=10, 11,-=- 13] can also benet from n-tuples, giving catamorphisms over mutually recursive data structures. First, a x point operator for terms, fix, and a x point operator at the type level, , must be added to ... |

96 |
and Oege de Moor. Algebra of Programming
- Bird
- 1997
(Show Context)
Citation Context ...not only program size, but also the number of laws and the length of program derivations. Consequently, the program transformation communitynotably the BirdMeertens Formalism (or Squiggol) community [=-=3, 12, 1-=-3]has been working to make programs more generic: not just polymorphic, but polytypic [811]. However, the genericity provided by polymorphism and polytypism is still not adequate to achieve certain ab... |

96 |
Algorithmics: Towards programming as a mathematical activity
- Meertens
- 1986
(Show Context)
Citation Context ...not only program size, but also the number of laws and the length of program derivations. Consequently, the program transformation communitynotably the BirdMeertens Formalism (or Squiggol) community [=-=3, 12, 1-=-3]has been working to make programs more generic: not just polymorphic, but polytypic [811]. However, the genericity provided by polymorphism and polytypism is still not adequate to achieve certain ab... |

84 |
Algebraic Data Types and Program Transformation
- Malcolm
- 1990
(Show Context)
Citation Context ...-tuple reduce} = h l m:l i {n-tuple eta} = m {n-tuple eta} 4.5 Generic Catamorphisms It was obvious that Haskell's zip family of functions could benet from n-tuples; but interestingly, catamorphisms [=-=10, 11,-=- 13] can also benet from n-tuples, giving catamorphisms over mutually recursive data structures. First, a x point operator for terms, fix, and a x point operator at the type level, , must be added to ... |

80 |
Report on the Programming Language Haskell
- Hudak, Jones, et al.
- 1992
(Show Context)
Citation Context ...t in more general programs (2.1), more general laws about those programs (2.2), and more general program derivations (2.3). 2.1 More General Programs The following functions are dened in the Haskell [=-=6]-=- Prelude and Libraries zip :: ([a],[b])![(a,b)] zip3 :: ([a],[b],[c])![(a,b,c)] ... zip7 :: ([a],[b],[c],[d],[e],[f],[g])![(a,b,c,d,e,f,g)] which combine lists element-wise. 1 Also, there are the fami... |

72 | A polymorphic record calculus and its compilation
- Ohori
- 1995
(Show Context)
Citation Context ...e) 3d); to allow for projections that are polymorphic over dimensions (e.g., projection 1 could be applied to a tuple of any size) would take the zip calculus into the realm of extensible records [4, =-=14, 19]-=-. N-tuples and extensible records seem to be orthogonal issues, though further investigation is required. Related also is Hoogendijk's thesis [5] in which he develops a notation for n-tuple valued fun... |

70 | A Polymorphic Type System for Extensible Records and Variants
- Gaster, Jones
- 1996
(Show Context)
Citation Context ...e) 3d); to allow for projections that are polymorphic over dimensions (e.g., projection 1 could be applied to a tuple of any size) would take the zip calculus into the realm of extensible records [4, =-=14, 19]-=-. N-tuples and extensible records seem to be orthogonal issues, though further investigation is required. Related also is Hoogendijk's thesis [5] in which he develops a notation for n-tuple valued fun... |

38 | Henk: A typed intermediate language
- Jones, Meijer
- 1997
(Show Context)
Citation Context ...us allows one to do this. 3 The Zip Calculus The zip calculus is a typed lambda calculus extended with n-tuples and sums. In particular, it starts as F!though in the form of a Pure Type System (PTS) [=-=2, 15]-=-. To this is added a construct for n-tuples and then n-sums are added (very simply using n-tuples). As the syntax of terms and types was becoming very close (because tuples exist at the type level), t... |

29 | Checking Algorithms for Pure Type Systems
- Jutting, S, et al.
- 1993
(Show Context)
Citation Context ...s; t; u 1 ) 2 R and (s; t; u 2 ) 2 R imply u 1 = u 2 ). In the zip calculus, A and R are functions. If a PTS is functional there is an ecient type-checking algorithm as given in Fig. 5 (cf. [15] and [17]), where the type judgments of Fig. 3 have been restructured to make them syntax-directed. The judgment (red) denes the relation ` x : X and sis beta-reduction. This algorithm can be modied as ... |

25 |
A Generic Theory of Datatypes
- Hoogendijk
- 1997
(Show Context)
Citation Context ... calculus into the realm of extensible records [4, 14, 19]. N-tuples and extensible records seem to be orthogonal issues, though further investigation is required. Related also is Hoogendijk's thesis =-=[5]-=- in which he develops a notation for n-tuple valued functors for program calculation; his notation is variable free, categorical, and heavily overloaded. 5.3 Summary Implementation has not been addres... |

17 | First class patterns
- Tullsen
- 2000
(Show Context)
Citation Context ...aybe(b) However, once this primitive is added, one can dene n-tuple patterns in terms of this primitive. (Using seqTupleMaybe we can translate patterns out of the language similarly to that done in [1=-=6]-=-.) Section 5.1 returns to this problem of functions that must be primitives. 4.2 More General Laws The parametricity theorem for an uncurried zip3 map(cross3 hf,g,hi)szip3 = zip3scross3 hmap f,map g,m... |

2 | Algebraic Types and Program Transformation - Malcolm - 1990 |