Safe Haskell | None |
---|---|
Language | Haskell98 |
Extras.Queue
Description
A Queue is a structure similar to a List, but elements are added to one end (the back) and retrieved from the other end (the front). Thus, a Queue is a FIFO (first-in first-out) structure, just like waiting lists that are served in the order of arrival.
Documentation
A Queue
To use the extra features in this module, you must begin your code with this line:
import Extras.Queue
The internal structure of a Queue
is not exposed. You need to use
the functions in this module to manipulate it.
A fresh new, empty Queue with the given Number as its identifier. Identifiers are arbitrary numbers that you can use to distinguish between several queues in your code.
qFront(queue,default)
is either the front element at queue
(when
it is not empty) or default
(when the queue
is empty)
A Queue like the given queue, but with the front element removed. If the given queue is empty, it remains unchanged.