package lwt

  1. Overview
  2. Docs

Module Lwt_pqueue.MakeSource

Generates priority queue types from ordered types.

Parameters

module Ord : OrderedType

Signature

Sourcetype elt = Ord.t

Type of elements contained in the priority queue.

Sourcetype t

Type of priority queues.

Sourceval empty : t

The empty priority queue. Contains no elements.

Sourceval is_empty : t -> bool

is_empty q evaluates to true iff q is empty.

Sourceval add : elt -> t -> t

add e q evaluates to a new priority queue, which contains all the elements of q, and the additional element e.

Sourceval union : t -> t -> t

union q q' evaluates to a new priority queue, which contains all the elements of both q and q'.

Sourceval find_min : t -> elt

find_min q evaluates to the minimum element of q if it is not empty, and raises Not_found otherwise.

Sourceval lookup_min : t -> elt option

lookup_min q evaluates to Some e, where e is the minimum element of q, if q is not empty, and evaluates to None otherwise.

Sourceval remove_min : t -> t

remove_min q evaluates to a new priority queue, which contains all the elements of q except for its minimum element. Raises Not_found if q is empty.

Sourceval size : t -> int

size q evaluates to the number of elements in q.

OCaml

Innovation. Community. Security.