Abstract
When an infinite sequence contains a bottom cell, we cannot access the rest of the sequence with the ordinary stream access. On the other hand, when we consider an extended stream access with two heads, we can read or write 1\(\bot\)-sequences, which are infinite sequences with at most one bottom cell. In this paper, we present a way of extending a lazy functional language with such an extended stream access in the realm of sequential computation. It has an application in real number computation in that the set of real numbers is topologically embedded in the set of 1 \(\bot\)-sequences [16], and therefore we can consider a program with such an extended stream access as directly manipulating real numbers. We implemented this mechanism by modifying the runtime of the Hugs system, which is a graph-reduction based implementation of the Haskell language. We present programming examples like addition and multiplication on real numbers in this extended Haskell.
For this implementation, we extended Haskell with the gamb operator, which works just as McCarthy’s bottom-avoiding nondeterministic choice operator “amb”. The difference is that it is realized in the realm of sequential computation, and that it is applicable only when the graph representations of the arguments share the same redex. In order to show that programs corresponding to two-head stream accesses satisfy this condition, we introduce a PCF-based calculus of term-graphs and define a data-type of 1 \(\bot\)-streams as a subtype of [Bool].
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Ariola, Z., Felleisen, M., Maraist, J., Odersky, M., Wadler, P.: A Call-by-Need Lambda Calculus. In: Proc. POPL 1995, 22’nd Annual Symposium on Principles of Programming Languages, San Francisco, California, pp. 233–246 (1995)
Du Bois, A., Pointon, R., Loidl, H.-W., Trinder, P.: Implementing Declarative Parallel Bottom-Avoiding Choice. In: Proc. 14th Symposium on Computer Architecture and High Performance Computing (2002)
Escardó, M.H., Hofmann, M., Streicher, T.: On the non-sequential nature of the interval-domain model of exact real-number computation. Mathematical Structures in Computer Science (to appear)
Di Gianantonio, P.: An Abstract Data Type for Real Numbers. Theoretical Computer Science 221, 295–326 (1999)
Gray, F.: Pulse code communications. U. S. Patent 2632058 (March 1953)
Jones, M.P.: The implementation of the Gofer functional programming system. Research Report YALEU/DCS/RR-1030, Yale University, USA (1994)
Peyton Jones, S.L.: The Implementation of Functional Programming Languages. Prentice-Hall, Englewood Cliffs (1987)
Jones, S.P. (ed.): Haskell 98 Language and Libraries, The Revised Report. Cambridge University Press, Cambridge (2003)
Kennaway, J.R., Klop, J.W., Sleep, M.R., de Vries, F.J.: An Introduction to Term Graph Rewriting. In: [14]
Raymundo Marcial-Romero, J., Escardó, M.H.: Semantics of a Sequential Language for Exact Real-Number Computation. In: Proceedings of the Annual IEEE Symbposium on Logic in Computer Science, pp. 426–435 (2004)
McCarthy, J.: A Basis for a Mathematical Theory of Computation. In: Braffort, P., Hirshberg, D. (eds.) Computer Programming and Formal Systems, pp. 33–70. North-Holland, Amsterdam (1963)
Hughes, J., Moran, A.: Making Choices Lazily. In: Conference Record of FPCA 1995, pp. 108–119. ACM Press, New York (1995)
Rose, K.H.: Graph-based Operational Semantics of a Lazy Functional Language. In: [14]
Sleep, R., Plasmeijer, R., van Eekelen, M. (eds.): Term Graph Rewriting: Theory and Practice. John Wiley & Sons Ltd, Chichester (1993)
Tsuiki, H.: Computational dimension of topological spaces. In: Blank, J., Brattka, V., Hertling, P. (eds.) CCA 2000. LNCS, vol. 2064, pp. 323–335. Springer, Heidelberg (2001)
Tsuiki, H.: Real number computation through gray code embedding. Theoretical Computer Science 284(2), 467–485 (2002)
Tsuiki, H.: Real Number Computation with Committed Choice Logic Programming. Journal of Logic and Algebraic Programming (2004) (to appear)
Weihrauch, K.: Computable analysis, an Introduction. Springer, Heidelberg (2000)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Tsuiki, H., Sugihara, K. (2005). Streams with a Bottom in Functional Languages. In: Sagiv, M. (eds) Programming Languages and Systems. ESOP 2005. Lecture Notes in Computer Science, vol 3444. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-31987-0_15
Download citation
DOI: https://doi.org/10.1007/978-3-540-31987-0_15
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-25435-5
Online ISBN: 978-3-540-31987-0
eBook Packages: Computer ScienceComputer Science (R0)