Real-Time persistent queues and deques with logic variables (declarative pearl)

  • Authors:
  • Gerlof Bouma

  • Affiliations:
  • Spraakbanken, Department of Swedish, University of Gothenburg, Gothenburg, Sweden

  • Venue:
  • FLOPS'12 Proceedings of the 11th international conference on Functional and Logic Programming
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

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.