Abstract
A domain-specific language (DSL) is a specification language designed to facilitate programming in a certain application domain. A well-designed DSL reflects the natural structure of the modeled domain, enforces abstraction, and its implementation exploits domain-specific properties for safety and performance. Expounding on the latter, in this paper we describe a simple, but powerful method for gradually enhancing a base implementation with computational performance improvements. It consists of adding constructors for expensive operations if this facilitates asymptotic performance improvements in some contexts, with at most constant-factor overhead. The resulting implementation can be thought of as executing "standard" computation steps from the base implementation interleaved with symbolic computation steps on the newly introduced constructors. Evaluation of constructor expressions is lazy in a strong sense: It does not only delay evaluation by thunkifying its standard evaluation, but performs run-time inspection to evaluate constructor expressions in a nonstandard way. Extending earlier work by Henglein and Larsen [1] on generic multiset programming we arrive at novel multiset representations with constructors for unions, Cartesian products, scalar multiplication, and mapping binary functions over Cartesian products. We show how the resulting implementation can be used to implement finite probability distributions with exact (rational) probabilities. It supports computing both the expected value and, what we believe to be novel, the variance of random variables over n-ary product distributions efficiently by avoiding enumeration of the product sample space.
Originalsprog | Engelsk |
---|---|
Titel | Logic-Based Program Synthesis and Transformation : 21st International Symposium, LOPSTR 2011, Odense, Denmark, July 18-20, 2011. Revised Selected Papers |
Redaktører | Germán Vidal |
Antal sider | 21 |
Forlag | Springer |
Publikationsdato | 2012 |
Sider | 4-24 |
ISBN (Trykt) | 978-3-642-32210-5 |
ISBN (Elektronisk) | 978-3-642-32211-2 |
DOI | |
Status | Udgivet - 2012 |
Begivenhed | 21st International Symposium on Logic-Based Program Synthesis and Transformation - Odense, Danmark Varighed: 18 jul. 2011 → 20 jul. 2011 Konferencens nummer: 21 |
Konference
Konference | 21st International Symposium on Logic-Based Program Synthesis and Transformation |
---|---|
Nummer | 21 |
Land/Område | Danmark |
By | Odense |
Periode | 18/07/2011 → 20/07/2011 |
Navn | Lecture notes in computer science |
---|---|
Vol/bind | 7225 |
ISSN | 0302-9743 |