Module CCSimple_queue
Functional queues (fifo)
type 'a sequence
= ('a -> unit) -> unit
type 'a printer
= Stdlib.Format.formatter -> 'a -> unit
type 'a klist
= unit -> [ `Nil | `Cons of 'a * 'a klist ]
type 'a gen
= unit -> 'a option
type +'a t
Queue containing elements of type 'a
val empty : 'a t
val is_empty : 'a t -> bool
val push : 'a -> 'a t -> 'a t
Push element at the end of the queue.
val peek : 'a t -> 'a option
First element of the queue.
val pop_exn : 'a t -> 'a * 'a t
Same as
pop
, but fails on empty queues.- raises Invalid_argument
if the queue is empty.
val append : 'a t -> 'a t -> 'a t
Append two queues. Elements from the second one come after elements of the first one. Linear in the size of the second queue.
module Infix : sig ... end
val length : 'a t -> int
Number of elements in the queue (linear in time).
val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
val iter : ('a -> unit) -> 'a t -> unit
val to_list : 'a t -> 'a list
val add_list : 'a t -> 'a list -> 'a t
val of_list : 'a list -> 'a t
val to_seq : 'a t -> 'a sequence
val add_seq : 'a t -> 'a sequence -> 'a t
val of_seq : 'a sequence -> 'a t
val to_klist : 'a t -> 'a klist
val add_klist : 'a t -> 'a klist -> 'a t
val of_klist : 'a klist -> 'a t
val of_gen : 'a gen -> 'a t
val add_gen : 'a t -> 'a gen -> 'a t
val to_gen : 'a t -> 'a gen