Solution (source code)

= Solution

A <FIFO queue> provides an empty queue, an emptiness test, insertion at the rear, inspection of the front item, and removal of the front item. It preserves insertion order: after enqueuing $x$ and then $y$, removing an item returns $x$ first. Inspection and removal on an empty <FIFO queue> must have a specified outcome, such as an <exception handling> case or an option-valued result. In a functional interface, insertion and removal return the new <FIFO queue> rather than updating their argument.