skip to main content
10.1145/871895.871896acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Functional Pearl trouble shared is trouble halved

Authors Info & Claims
Published:28 August 2003Publication History

ABSTRACT

A nexus is a tree that contains shared nodes, nodes that have more than one incoming arc. Shared nodes are created in almost every functional program---for instance, when updating a purely functional data structure---though programmers are seldom aware of this. In fact, there are only a few algorithms that exploit sharing of nodes consciously. One example is constructing a tree in sublinear time. In this pearl we discuss an intriguing application of nexuses; we show that they serve admirably as memo structures featuring constant time access to memoized function calls. Along the way we encounter Boolean lattices and binomial trees.

References

  1. Richard Bird and Oege de Moor. Algebra of Programming. Prentice Hall Europe, London, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms. The MIT Press, Cambridge, Massachusetts, second edition, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Ralf Hinze. Memo functions, polytypically! In Johan Jeuring, editor, Proceedings of the 2nd Workshop on Generic Programming, Ponte de Lima, Portugal, pages 17--32, July 2000. The proceedings appeared as a technical report of Universiteit Utrecht, UU-CS-2000-19.Google ScholarGoogle Scholar
  4. Graham Hutton. Functional Pearl: the countdown problem. Journal of Functional Programming, 12(6):609--616, November 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Donald E. Knuth. The Art of Computer Programming, Volume 1: Fundamental Algorithms. Addison-Wesley Publishing Company, 3rd edition, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. E. Meijer, M. Fokkinga, and R. Paterson. Functional programming with bananas, lenses, envelopes and barbed wire. In 5th ACM Conference on Functional Programming Languages and Computer Architecture, FPCA'91, Cambridge, MA, USA, volume 523 of Lecture Notes in Computer Science, pages 124--144. Springer-Verlag, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Donald Michie. "Memo" functions and machine learning. Nature, (218):19--22, April 1968.Google ScholarGoogle Scholar
  8. Shin-Cheng Mu. A calculational approach to program inversion. PhD thesis, Oxford University Computing Laboratory, 2003.Google ScholarGoogle Scholar
  9. Chris Okasaki. Functional Pearl: Three algorithms on Braun trees. Journal of Functional Programming, 7(6), November 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Simon Peyton Jones. Haskell 98 Language and Libraries. Cambridge University Press, 2003.Google ScholarGoogle Scholar
  11. Neil Sarnak and Robert~E. Tarjan. Planar point location using persistent search trees. Communications of the ACM, 29(7):669--679, July 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Functional Pearl trouble shared is trouble halved

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          Haskell '03: Proceedings of the 2003 ACM SIGPLAN workshop on Haskell
          August 2003
          114 pages
          ISBN:1581137583
          DOI:10.1145/871895

          Copyright © 2003 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 28 August 2003

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • Article

          Acceptance Rates

          Haskell '03 Paper Acceptance Rate10of30submissions,33%Overall Acceptance Rate57of143submissions,40%

          Upcoming Conference

          ICFP '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader