Uqueue.S
val create : int -> t
Create a new empty unique queue. The int
parameter is passed to the backing Hashtbl
used to ensure uniqueness.
push q x
adds x
at the end of the queue q
. Does nothing if x
is already present in the queue.
pop q
removes and returns the first element in queue q
, or raises Empty
if the queue is empty.
peek q
returns the first element in queue q
without removing it, or raises Empty
if the queue is empty.
val is_empty : t -> bool
Returns true
if the queue is empty, false
otherwise.
val clear : t -> unit
Discard all elements from the queue.