Module Prelude.Queue

Purely functional FIFO queues.

This is the data structure due to F. Warren Burton, "An Efficient Functional Implementation of FIFO Queues", Information Processing Letters, 1982.

type 'a t
val compare : 'a t -> 'a t -> int
val empty : 'a t
val null : 'a t -> bool
val size : 'a t -> int
val enq : 'a -> 'a t -> 'a t
val push : 'a -> 'a t -> 'a t
val peek : 'a t -> 'a option
val deq : 'a t -> 'a option * 'a t
val pop : 'a t -> 'a option * 'a t
val drop : 'a t -> 'a t
val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list
val random : ?size:(unit -> int) -> (unit -> 'a) -> unit -> 'a t