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.
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
Augusteijn, L.: Sorting morphisms. In: Swierstra, S.D., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608, pp. 1–27. Springer, Heidelberg (1999)
Beeler, M., Gosper, R.W., Schroeppel, R.: Hakmem. AIM 239, MIT (February 1972)
Bird, R., de Moor, O.: The Algebra of Programming. Prentice-Hall, Englewood Cliffs (1996)
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)
Bird, R.S.: Introduction to Functional Programming Using Haskell. Prentice-Hall, Englewood Cliffs (1998)
Bird, R.S., Wadler, P.L.: An Introduction to Functional Programming. Prentice-Hall, Englewood Cliffs (1988)
Boiten, E.: The many disguises of accumulation. Technical Report 91-26, Department of Informatics, University of Nijmegen (December 1991)
Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1995)
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
Gibbons, J.: Polytypic downwards accumulations. In: Jeuring, J. (ed.) MPC 1998. LNCS, vol. 1422, Springer, Heidelberg (1998)
Gibbons, J.: Generic downwards accumulations. Science of Computer Programming 37, 37–65 (2000)
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)
Gibbons, J.: Origami programming. In: Gibbons, J., de Moor, O. (eds.) The Fun of Programming, Cornerstones in Computing, Palgrave (2003)
Gibbons, J.: An unbounded spigot algorithm for the digits of π. Draft (November 2003)
Gibbons, J., Hutton, G.: Proof methods for corecursive programs (submitted for publication) (March 2004)
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)
Gosper, B.: Continued fraction arithmetic. Unpublished manuscript (1981)
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)
Hoare, C.A.R.: Quicksort. Computer Journal 5, 10–15 (1962)
Hughes, J.: Why functional programming matters. Computer Journal 32(2), 98–107 (1989), Also in [36]
Hutton, G., Meijer, E.: Back to basics: Deriving representation changers functionally. Journal of Functional Programming 6(1), 181–188 (1996)
Jackson, M.A.: Principles of Program Design. Academic Press, London (1975)
Jacobs, B.: Mongruences and cofree coalgebras. In: Alagar, V.S., Nivat, M. (eds.) AMAST 1995. LNCS, vol. 936, Springer, Heidelberg (1995)
Jones, S.P.: Arbitrary precision arithmetic using continued fractions. INDRA Working Paper 1530, Dept of CS, University College, London (January 1984)
Jones, S.P.: The Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)
Lester, D.: Vuillemin’s exact real arithmetic. In: Heldal, R., Holst, C.K., Wadler, P. (eds.) Glasgow Functional Programming Workshop, pp. 225–238 (1991)
Lester, D.: Effective continued fractions. In: Proceedings of the Fifteenth IEEE Arithmetic Conference (2001)
Malcolm, G.: Data structures and program transformation. Science of Computer Programming 14, 255–279 (1990)
Meertens, L.: Paramorphisms. Formal Aspects of Computing 4(5), 413–424 (1992)
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)
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
Potts, P.J.: Exact Real Arithmetic using Möbius Transformations. PhD thesis, Imperial College, London (July 1998)
Rabinowitz, S., Wagon, S.: A spigot algorithm for the digits of π. American Mathematical Monthly 102(3), 195–203 (1995)
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)
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)
Turner, D.A. (ed.): Research Topics in Functional Programming. University of Texas at Austin, Addison-Wesley (1990)
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
Vuillemin, J.: Exact real arithmetic with continued fractions. IEEE Transactions on Computers 39(8), 1087–1105 (1990)
Wadler, P.: Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science 73, 231–248 (1990)
Witten, I.H., Neal, R.M., Cleary, J.G.: Arithmetic coding for data compression. Communications of the ACM 30(6), 520–540 (1987)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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