Abstract
This paper illustrates a method of transforming an initial specification expression, which is not necessarily algorithmic, into an efficient functional implementation using a refinement calculus for expressions. In doing this, we benefit from the ease of manipulation that state-less expressions allow. However, implementations of functional algorithms are not as cheap as imperative implementations. We further show how an imperative program can be derived from a functional expression using algebraic transformations based on the state monad model. The example used to illustrate the method is Bresenham’s line drawing algorithm.
Supported by a postgraduate research studentship from the Engineering and Physical Sciences Research Council.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Roland Backhouse. An exploration of the Bird-Meertens Formalism. International Summerschool on Constructive Algorithmics, Ameland 1989, September 1989.
Richard S. Bird. An introduction to the theory of lists. In M. Broy, editor, Logic of Programming and Calculi of Discrete Design, volume F36 of NATO ASI Series. Springer Verlag, 1986.
J. E. Bresenham. An algorithm for computer control of a digital plotter. IBM Syst. J., 4(1):25 — 30, 1965.
John Launchbury. Lazy imperative programming. ACM SigPlan Workshop on State in Prog. Langs., June 1993.
John Launchbury and Simon Peyton Jones. Lazy functional state threads. In Programming Languages Design and Implementation, 1994.
Lambert Meertens. Algorithmics - towards programming as a mathematical activity. Mathematics and Computer Science, 1, 1986. CWI Monographs (J. W. de Bakker, M. Hazewinkel, J. K. Lenstra, eds.) North Holland, Puhl. Co.
J.M. Morris. Programs from Specifications. In Edsger W. Dijkstra, editor, Formal Development of Programs and Proofs, University of Texas at Austin Year of Programming Series, chapter 9, pages 81115. Addison-Wesley, 1989.
C. Morgan. Programming from Specifications. Prentice Hall, U.K., 1990.
John T. O’Donnell. Bidirectional fold and scan. In John T. O’Donnell and Kevin Hammond, editors, Functional Programming, Glasgow 1993, Workshops in Computing Science, pages 193 — 200. Springer Verlag, July 1993. Proceedings of the 1993 Glasgow Workshop on Functional Programming, Ayr, Scotland, 5–7 July 1993.
Simon L. Peyton Jones and Philip Wadler. Imperative functional programming. Principles of Programming Languages, January 1993.
Jan L. A. Snepscheut. What computing is all about. Texts and Monographs in Computer Science. Springer Verlag, 1993.
Robert F. Sproull. Using program transformations to derive line-drawing algorithms. ACM Transactions on Graphics, 1(4):259 — 273, October 1982.
Rod Salmon and Mel Slater. Computer Graphics, Systems and Concepts. Addison Wesley, 1987.
Philip Wadler. The essence of functional programming. January 1992. Presented at 19th Annual Symposium on Principles of Programming languages, Albuquerque, New Mexico.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1995 Springer-Verlag London
About this paper
Cite this paper
Bunkenburg, A., Flynn, S. (1995). Expression Refinement: Deriving Bresenham’s Algorithm. In: Hammond, K., Turner, D.N., Sansom, P.M. (eds) Functional Programming, Glasgow 1994. Workshops in Computing. Springer, London. https://doi.org/10.1007/978-1-4471-3573-9_1
Download citation
DOI: https://doi.org/10.1007/978-1-4471-3573-9_1
Publisher Name: Springer, London
Print ISBN: 978-3-540-19914-4
Online ISBN: 978-1-4471-3573-9
eBook Packages: Springer Book Archive