This module provides (double-ended) FIFO queues in an efficient manner.
All functions fail with reason 
Some functions, where noted, fail with reason 
The data representing a queue as used by this module is to be regarded as opaque by other modules. Any code assuming knowledge of the format is running on thin ice.
All operations has an amortized O(1) running time, except
      
Queues are double-ended. The mental picture of a queue is a line of people (items) waiting for their turn. The queue front is the end with the item that has waited the longest. The queue rear is the end an item enters when it starts to wait. If instead using the mental picture of a list, the front is called head and the rear is called tail.
Entering at the front and exiting at the rear are reverse operations on the queue.
This module has three sets of interface functions: the "Original API", the "Extended API", and the "Okasaki API".
The "Original API" and the "Extended API" both use the mental picture of a waiting line of items. Both have reverse operations suffixed "_r".
The "Original API" item removal functions return compound terms with both the removed item and the resulting queue. The "Extended API" contains alternative functions that build less garbage and functions for just inspecting the queue ends. Also the "Okasaki API" functions build less garbage.
The "Okasaki API" is inspired by "Purely Functional Data Structures" by Chris Okasaki. It regards queues as lists. This API is by many regarded as strange and avoidable. For example, many reverse operations have lexically reversed names, some with more readable but perhaps less understandable aliases.
As returned by
        
Returns a queue 
If 
So, 
Returns a queue containing the items in 
Inserts 
Inserts 
Tests if 
Tests if 
Returns a queue 
Calculates and returns the length of queue 
Returns 
Returns an empty queue.
Removes the item at the front of queue 
Removes the item at the rear of queue 
Returns a queue 
Splits 
Returns a list of the items in the queue in the same order; the front item of the queue becomes the head of the list.
Returns a queue 
Fails with reason 
Returns a queue 
Fails with reason 
Returns 
Fails with reason 
Returns 
Fails with reason 
Returns tuple 
Returns tuple 
Inserts 
Returns the tail item of queue 
Fails with reason 
Returns 
Fails with reason 
Returns a queue 
Fails with reason 
Returns a queue 
Fails with reason 
The name 
Returns the tail item of queue 
Fails with reason 
Returns a queue 
Fails with reason 
Inserts 
Returns a queue 
Fails with reason