Skip to main content

Streaming Representation-Changers

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 3125))

Abstract

Unfolds generate data structures, and folds consume them. A hylomorphism is a fold after an unfold, generating then consuming a virtual data structure. A metamorphism is the opposite composition, an unfold after a fold; typically, it will convert from one data representation to another. In general, metamorphisms are less interesting than hylomorphisms: there is no automatic fusion to deforest the intermediate virtual data structure. However, under certain conditions fusion is possible: some of the work of the unfold can be done before all of the work of the fold is complete. This permits streaming metamorphisms, and among other things allows conversion of infinite data representations. We present a theory of metamorphisms and outline some examples.

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

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.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

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Augusteijn, L.: Sorting morphisms. In: Swierstra, S.D., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608, pp. 1–27. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  2. Beeler, M., Gosper, R.W., Schroeppel, R.: Hakmem. AIM 239, MIT (February 1972)

    Google Scholar 

  3. Bird, R., de Moor, O.: The Algebra of Programming. Prentice-Hall, Englewood Cliffs (1996)

    Google Scholar 

  4. Bird, R., Gibbons, J.: Arithmetic coding with folds and unfolds. In: Jeuring, J., Jones, S.L.P. (eds.) AFP 2002. LNCS, vol. 2638, Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  5. Bird, R.S.: Introduction to Functional Programming Using Haskell. Prentice-Hall, Englewood Cliffs (1998)

    Google Scholar 

  6. Bird, R.S., Wadler, P.L.: An Introduction to Functional Programming. Prentice-Hall, Englewood Cliffs (1988)

    Google Scholar 

  7. Boiten, E.: The many disguises of accumulation. Technical Report 91-26, Department of Informatics, University of Nijmegen (December 1991)

    Google Scholar 

  8. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1995)

    Google Scholar 

  9. Gibbons, J.: Algebras for Tree Algorithms. D.Phil. thesis, Programming Research Group, Oxford University (1991), Available as Technical Monograph PRG-94. ISBN 0-902928-72-4

    Google Scholar 

  10. Gibbons, J.: Polytypic downwards accumulations. In: Jeuring, J. (ed.) MPC 1998. LNCS, vol. 1422, Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  11. Gibbons, J.: Generic downwards accumulations. Science of Computer Programming 37, 37–65 (2000)

    Article  MATH  MathSciNet  Google Scholar 

  12. Gibbons, J.: Chapter 5 Calculating Functional Programs. In: Blackhouse, R., Crole, R.L., Gibbons, J. (eds.) Algebraic and Coalgebraic Methods in the Mathematics of Program Construction. LNCS, vol. 2297, pp. 149–203. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  13. Gibbons, J.: Origami programming. In: Gibbons, J., de Moor, O. (eds.) The Fun of Programming, Cornerstones in Computing, Palgrave (2003)

    Google Scholar 

  14. Gibbons, J.: An unbounded spigot algorithm for the digits of π. Draft (November 2003)

    Google Scholar 

  15. Gibbons, J., Hutton, G.: Proof methods for corecursive programs (submitted for publication) (March 2004)

    Google Scholar 

  16. Gibbons, J., Jones, G.: The under-appreciated unfold. In: Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming, Baltimore, Maryland, September 1998, pp. 273–279 (1998)

    Google Scholar 

  17. Gosper, B.: Continued fraction arithmetic. Unpublished manuscript (1981)

    Google Scholar 

  18. Hagino, T.: A typed lambda calculus with categorical type constructors. In: Pitt, D.H., Rydeheard, D.E., Poigné, A. (eds.) Category Theory and Computer Science. LNCS, vol. 283, pp. 140–157. Springer, Heidelberg (1987)

    Google Scholar 

  19. Hoare, C.A.R.: Quicksort. Computer Journal 5, 10–15 (1962)

    Google Scholar 

  20. Hughes, J.: Why functional programming matters. Computer Journal 32(2), 98–107 (1989), Also in [36]

    Google Scholar 

  21. Hutton, G., Meijer, E.: Back to basics: Deriving representation changers functionally. Journal of Functional Programming 6(1), 181–188 (1996)

    Article  Google Scholar 

  22. Jackson, M.A.: Principles of Program Design. Academic Press, London (1975)

    Google Scholar 

  23. Jacobs, B.: Mongruences and cofree coalgebras. In: Alagar, V.S., Nivat, M. (eds.) AMAST 1995. LNCS, vol. 936, Springer, Heidelberg (1995)

    Google Scholar 

  24. Jones, S.P.: Arbitrary precision arithmetic using continued fractions. INDRA Working Paper 1530, Dept of CS, University College, London (January 1984)

    Google Scholar 

  25. Jones, S.P.: The Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)

    Google Scholar 

  26. Lester, D.: Vuillemin’s exact real arithmetic. In: Heldal, R., Holst, C.K., Wadler, P. (eds.) Glasgow Functional Programming Workshop, pp. 225–238 (1991)

    Google Scholar 

  27. Lester, D.: Effective continued fractions. In: Proceedings of the Fifteenth IEEE Arithmetic Conference (2001)

    Google Scholar 

  28. Malcolm, G.: Data structures and program transformation. Science of Computer Programming 14, 255–279 (1990)

    Article  MATH  MathSciNet  Google Scholar 

  29. Meertens, L.: Paramorphisms. Formal Aspects of Computing 4(5), 413–424 (1992)

    Article  MATH  Google Scholar 

  30. Meijer, E., Fokkinga, M., Paterson, R.: Functional programming with bananas, lenses, envelopes and barbed wire. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 124–144. Springer, Heidelberg (1991)

    Google Scholar 

  31. Pardo, A.: Generic accumulations. In: Gibbons, J., Jeuring, J. (eds.) Generic Programming, pp. 49–78. Kluwer Academic Publishers, Dordrecht (2003), Proceedings of the IFIP TC2Working Conference on Generic Programming, Schloß Dagstuhl (July 2002) ISBN 1-4020-7374-7

    Google Scholar 

  32. Potts, P.J.: Exact Real Arithmetic using Möbius Transformations. PhD thesis, Imperial College, London (July 1998)

    Google Scholar 

  33. Rabinowitz, S., Wagon, S.: A spigot algorithm for the digits of π. American Mathematical Monthly 102(3), 195–203 (1995)

    Article  MATH  MathSciNet  Google Scholar 

  34. Reynolds, J.C.: Definitional interpreters for higher-order programming languages. Higher Order and Symbolic Computing 11(4), 363–397 (1998), Reprinted from the Proceedings of the 25th ACM National Conference (1972)

    Google Scholar 

  35. Swierstra, D., de Moor, O.: Virtual data structures. In: Möller, B., Schuman, S., Partsch, H. (eds.) Formal Program Development. LNCS, vol. 755, pp. 355–371. Springer, Heidelberg (1993)

    Google Scholar 

  36. Turner, D.A. (ed.): Research Topics in Functional Programming. University of Texas at Austin, Addison-Wesley (1990)

    Google Scholar 

  37. Vene, V., Uustalu, T.: Functional programming with apomorphisms (corecursion). In: Proceedings of the Estonian Academy of Sciences: Physics, Mathematics, vol. 47(3), pp. 147–161 (1998) 9th Nordic Workshop on Programming Theory

    Google Scholar 

  38. Vuillemin, J.: Exact real arithmetic with continued fractions. IEEE Transactions on Computers 39(8), 1087–1105 (1990)

    Article  MathSciNet  Google Scholar 

  39. Wadler, P.: Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science 73, 231–248 (1990)

    Article  MATH  MathSciNet  Google Scholar 

  40. Witten, I.H., Neal, R.M., Cleary, J.G.: Arithmetic coding for data compression. Communications of the ACM 30(6), 520–540 (1987)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2004 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Gibbons, J. (2004). Streaming Representation-Changers. In: Kozen, D. (eds) Mathematics of Program Construction. MPC 2004. Lecture Notes in Computer Science, vol 3125. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-27764-4_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-27764-4_9

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-22380-1

  • Online ISBN: 978-3-540-27764-4

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics