Module Uqueue.Make

Parameters

module H : Stdlib.Hashtbl.HashedType

Signature

type elt = H.t

The type of elements in the unique queue.

type t

The type of unique queues with elt elements.

val create : int -> t

Create a new empty unique queue. The int parameter is passed to the backing Hashtbl used to ensure uniqueness.

val push : t -> elt -> unit

push q x adds x at the end of the queue q. Does nothing if x is already present in the queue.

exception Empty

Raised when pop or peek are applied to an empty queue.

val pop : t -> elt

pop q removes and returns the first element in queue q, or raises Empty if the queue is empty.

  • raises Empty

    if the queue is empty.

val peek : t -> elt

peek q returns the first element in queue q without removing it, or raises Empty if the queue is empty.

  • 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.