Skip to main content

Real-Time Persistent Queues and Deques with Logic Variables (Declarative Pearl)

  • Conference paper
Functional and Logic Programming (FLOPS 2012)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 7294))

Included in the following conference series:

  • 589 Accesses

Abstract

We present a Prolog implementation of real-time persistent queues and double-ended queues. Our implementation is inspired by Okasaki’s lazy-functional approach, but relies only on standard Prolog, comprising of the pure subset plus if-then-else constructs to efficiently implement guards and meta-calls for convenience. The resulting data structure is a nice demonstration of the fact that the use of logic variables to hold the outcome of an unfinished computation can sometimes give the same kind of elegant and compact solutions as lazy evaluation.

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

Access this chapter

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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Hood, R., Melville, R.: Real-time queue operations in pure LISP. Computer science technical report, Cornell University (1980), http://hdl.handle.net/1813/6273

  2. O’Keefe, R.A.: The Craft of Prolog. The MIT Press, Cambridge (1990)

    Google Scholar 

  3. Okasaki, C.: Simple and Efficient Purely Functional Queues and Deques. J. Functional Programming 5(4), 583–592 (1995)

    Article  Google Scholar 

  4. Schrijvers, T., Santos Costa, V., Wielemaker, J., Demoen, B.: Towards Typed Prolog. In: Garcia de la Banda, M., Pontelli, E. (eds.) ICLP 2008. LNCS, vol. 5366, pp. 693–697. Springer, Heidelberg (2008), http://dx.doi.org/10.1007/978-3-540-89982-2_59

    Chapter  Google Scholar 

  5. Hood, R.T.: The Efficient Implementation of Very-High-Level Programming Language Constructs. Computer science technical report, Cornell University (1982), http://hdl.handle.net/1813/6343

  6. Chuang, T.-R., Goldberg, B.: Real-time deques, multihead turing machines, and purely functional programming. In: Proceedings of the Conference on Functional Programming and Computer Architecture, pp. 289–298. ACM, New York (1993)

    Google Scholar 

  7. Sterling, L., Shapiro, E.: The Art of Prolog. The MIT Press, Cambridge (1986)

    MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Bouma, G. (2012). Real-Time Persistent Queues and Deques with Logic Variables (Declarative Pearl). In: Schrijvers, T., Thiemann, P. (eds) Functional and Logic Programming. FLOPS 2012. Lecture Notes in Computer Science, vol 7294. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-29822-6_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-29822-6_8

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-29821-9

  • Online ISBN: 978-3-642-29822-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics