module Fqueue: Fqueue
exception Empty
type 'a
t
val sexp_of_t : ('a -> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t
val t_of_sexp : (Sexplib.Sexp.t -> 'a) -> Sexplib.Sexp.t -> 'a t
val bin_size_t : 'a Bin_prot.Size.sizer -> 'a t Bin_prot.Size.sizer
val bin_write_t : 'a Bin_prot.Unsafe_write_c.writer -> 'a t Bin_prot.Write_ml.writer
val bin_write_t_ : 'a Bin_prot.Unsafe_write_c.writer ->
'a t Bin_prot.Unsafe_write_c.writer
val bin_writer_t : 'a Bin_prot.Type_class.writer -> 'a t Bin_prot.Type_class.writer
val bin_read_t : 'a Bin_prot.Unsafe_read_c.reader -> 'a t Bin_prot.Read_ml.reader
val bin_read_t_ : 'a Bin_prot.Unsafe_read_c.reader -> 'a t Bin_prot.Unsafe_read_c.reader
val bin_read_t__ : 'a Bin_prot.Unsafe_read_c.reader ->
(int -> 'a t) Bin_prot.Unsafe_read_c.reader
val bin_reader_t : 'a Bin_prot.Type_class.reader -> 'a t Bin_prot.Type_class.reader
val bin_t : 'a Bin_prot.Type_class.t -> 'a t Bin_prot.Type_class.t
val test_invariants : 'a t -> unit
test via asserts whether invariants hold
val empty : 'a t
The empty queue
val push : 'a -> 'a t -> 'a t
push a single element on queue
val push_top : 'a -> 'a t -> 'a t
push a single element on the *top* of the queue
val enq : 'a -> 'a t -> 'a t
alias for push
val bot_exn : 'a t -> 'a
returns the bottom (most-recently enqueued element). Raises Empty
if no element is
found.
val bot : 'a t -> 'a option
like bot_exn
, but returns result optionally, without exception
val top_exn : 'a t -> 'a
Like bot_exn
, except returns top (least-recently enqueued element
val top : 'a t -> 'a option
like top_exn
, but returns result optionally, without exception
val pop_exn : 'a t -> 'a * 'a t
Like top_exn
, but returns pair of the top element, and a new queue with the top element
removed
val pop : 'a t -> ('a * 'a t) option
Like pop_exn
, but returns result optionally, without exception
val deq : 'a t -> ('a * 'a t) option
alias for pop
val deq_exn : 'a t -> 'a * 'a t
alias for pop_exn
val discard_exn : 'a t -> 'a t
Returns version of queue with top element removed
val to_list : 'a t -> 'a list
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).
val length : 'a t -> int
val is_empty : 'a t -> bool