Abstract
AbstractWe introduce the notion ofdiscriminationas a generalization of both sorting and partitioning, and show thatdiscriminators(discrimination functions) can be definedgenerically, by structural recursion on representations oforderingandequivalence relations. Discriminators improve the asymptotic performance of generic comparison-based sorting and partitioning, and can be implemented not to expose more information than the underlying ordering, respectively equivalence relation. For a large class of order and equivalence representations, including all standard orders for regular recursive first-order types, the discriminators execute in the worst-case linear time. The generic discriminators can be coded compactly using list comprehensions, with order and equivalence representations specified using Generalized Algebraic Data Types. We give some examples of the uses of discriminators, including the most-significant digit lexicographic sorting, type isomorphism with an associative-commutative operator, and database joins. Source code of discriminators and their applications in Haskell is included. We argue that built-in primitive types, notably pointers (references), should come with efficient discriminators, not just equality tests, since they facilitate the construction of discriminators for abstract types that are both highly efficient and representation-independent.
Publisher
Cambridge University Press (CUP)
Reference50 articles.
1. Data Structures and Algorithms 1
2. Hudak P. , Peterson J. & Fasel J. H. (1999, May) A Gentle Introduction to Haskell, Version 98. Online tutorial. Available at: http://www.haskell.org/tutorial.
3. Implementing radixsort
Cited by
3 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Intersecting two families of sets on the GPU;Journal of Parallel and Distributed Computing;2017-06
2. A relational framework for higher-order shape analysis;ACM SIGPLAN Notices;2014-11-26
3. A relational framework for higher-order shape analysis;Proceedings of the 19th ACM SIGPLAN international conference on Functional programming;2014-08-19