Skip to main content

Expression Refinement: Deriving Bresenham’s Algorithm

  • Conference paper
Functional Programming, Glasgow 1994

Part of the book series: Workshops in Computing ((WORKSHOPS COMP.))

  • 71 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Roland Backhouse. An exploration of the Bird-Meertens Formalism. International Summerschool on Constructive Algorithmics, Ameland 1989, September 1989.

    Google Scholar 

  2. 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.

    Google Scholar 

  3. J. E. Bresenham. An algorithm for computer control of a digital plotter. IBM Syst. J., 4(1):25 — 30, 1965.

    Google Scholar 

  4. John Launchbury. Lazy imperative programming. ACM SigPlan Workshop on State in Prog. Langs., June 1993.

    Google Scholar 

  5. John Launchbury and Simon Peyton Jones. Lazy functional state threads. In Programming Languages Design and Implementation, 1994.

    Google Scholar 

  6. 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.

    Google Scholar 

  7. 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.

    Google Scholar 

  8. C. Morgan. Programming from Specifications. Prentice Hall, U.K., 1990.

    MATH  Google Scholar 

  9. 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.

    Google Scholar 

  10. Simon L. Peyton Jones and Philip Wadler. Imperative functional programming. Principles of Programming Languages, January 1993.

    Google Scholar 

  11. Jan L. A. Snepscheut. What computing is all about. Texts and Monographs in Computer Science. Springer Verlag, 1993.

    Google Scholar 

  12. Robert F. Sproull. Using program transformations to derive line-drawing algorithms. ACM Transactions on Graphics, 1(4):259 — 273, October 1982.

    Google Scholar 

  13. Rod Salmon and Mel Slater. Computer Graphics, Systems and Concepts. Addison Wesley, 1987.

    Google Scholar 

  14. Philip Wadler. The essence of functional programming. January 1992. Presented at 19th Annual Symposium on Principles of Programming languages, Albuquerque, New Mexico.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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

Publish with us

Policies and ethics