Stacking Cycles: Functional Transformation of Circular Data
- 195 Downloads
Functional programming is very powerful when applied to tree-shaped data. Real-world software problems often involve circular graph-shaped data. In this paper, we characterize a class of functions on circular data graphs extending the class of primitively corecursive functions. We propose an abstract, effective implementation technique for these functions under an eager evaluation strategy on standard stack machines. The proposed implementation ensures termination and can be tuned either for exactness or for speed. The latter variant is asymptotically as efficient as standard implementations of algebraic recursion, at the price of suboptimal homomorphic result graphs with decently bounded redundancy.
KeywordsCoalgebra corecursion anamorphism code generation cycle detection function memoization
Unable to display preview. Download preview PDF.
- ASU86.A.V. Aho, R. Sethi, and J.D. Ullman. Compilers: Principles, Techniques, and Tools. Addison-Wesley, 1986.Google Scholar
- Bro85.D.R. Brownbridge. Cyclic reference counting for combinator machines. In LNCS, volume 201. Springer, 1985.Google Scholar
- CF92.R. Cockett and T. Fukushima. About Charity. Technical Report 92/480/18, University of Calgary, 1992.Google Scholar
- Erw01.M. Erwig. Inductive graphs and functional graph algorithms, 2001.Google Scholar
- MFP91.E. Meijer, M. Fokkinga, and R. Paterson. Functional programming with bananas, lenses, envelopes and barbed wire. In Proceedings of the ACM FPCA’91, LNCS, volume 523. Springer, 1991.Google Scholar
- Pep91.P. Pepper. The Programming Language OPAL (5th corrected edition). Technical Report 91-10, TU Berlin, June 1991.Google Scholar
- PvEP88.E.J.H. Pepels, M.C.J.D. van Eekelen, and M.J. Plasmeijer. A cyclic reference counting algorithm and its proof. Technical Report 88-10, Computing Science Department, University of Nijmegen, 1988.Google Scholar
- Rut96.J.J.M.M. Rutten. Universal Coalgebra: a Theory of Systems, Technical Report CS-R9652. CWI, Amsterdam, 1996.Google Scholar
- Sal87.J.D. Salkild. Implementation and analysis of two reference counting algorithms. Master’s thesis, University College, London, 1987.Google Scholar
- TT97.A. Telford and D. Turner. Ensuring streams flow. In Algebraic Methodology and Software Technology, pages 509–523, 1997.Google Scholar