Queues

The following queue manipulation routines are available once included with the use_module(library(queues)) command.

Queues are implemented with difference lists.

In this package, a queue is represented as a term Front-Back, where Front is a list and Back is a tail of that list, and is normally a variable. join_queue will only work when the Back is a variable, the other routines will accept any tail. The elements of the queue are the list difference, that is, all the elements starting at Front and stopping at Back. Examples:

[a,b,c,d,e|Z]-Z has elements a,b,c,d,e [a,b,c,d,e]-[d,e] has elements a,b,c Z-Z has no elements [1,2,3]-[1,2,3] has no elements