queue
queue
Module
queue
Module summary
Abstract data type for FIFO queues.
Description
This module provides (double-ended) FIFO queues in an efficient manner.
All functions fail with reason badarg
if arguments are of wrong type, for example, queue arguments are not queues, indexes are not integers, and list arguments are not lists. Improper lists cause internal crashes. An index out of range for a queue also causes a failure with reason badarg
.
Some functions, where noted, fail with reason empty
for an empty queue.
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 filter/2<