package ke
Library
Module
Module type
Parameter
Class
Class type
val empty : 'a t
An empty queue.
val is_empty : 'a t -> bool
Return true
if the given queue is empty, false
otherwise.
val length : 'a t -> int
Number of elements in the queue.
val peek : 'a t -> 'a option
peek q
returns the first element in the queue q
, without removing it from the queue. If q
is empty, it returns None
.
Get and remove the first element. If q
is empty, it returns None
.
Get and remove the last element. If q
is empty, it returns None
.
val iter : ('a -> unit) -> 'a t -> unit
iter f q
applies f
in turn to all elements of q
, from the least recently entered to the most recently entered. The queue itself is unchanged.
val rev_iter : ('a -> unit) -> 'a t -> unit
rev_iter f q
applies f
in turn to all elements of q
, from the most recently entered to the least recently entered. The queue itself is unchanged.
val fold : ('acc -> 'x -> 'acc) -> 'acc -> 'x t -> 'acc
fold f a q
is equivalent to List.fold_left f a l
, where l
is the list of q
's elements. The queue remains unchanged.