A simple polymorphic functional queue.
Amortized running times assumes that enqueue/dequeue are used sequentially, threading the changing Fqueue through the calls.
returns the bottom (most-recently enqueued element). Raises
Empty if no element is
found. Complexity: O(1)
bot_exn, but returns result optionally, without exception. Complexity: O(1)
bot_exn, except returns top (least-recently enqueued element. Complexity:
top_exn, but returns result optionally, without exception, Complexity: O(1)
to_list t returns a list of the elements in
t in order from least-recently-added
(at the head) to most-recently added (at the tail). Complexity: O(n)