Functional queues (fifo)
Simple implementation of functional queues
Sourcetype 'a sequence = ('a -> unit) -> unit Sourcetype 'a iter = ('a -> unit) -> unit Sourcetype 'a klist = unit -> [ `Nil | `Cons of 'a * 'a klist ] Sourcetype 'a gen = unit -> 'a option Queue containing elements of type 'a
Push element at the end of the queue.
First element of the queue.
Sourceval pop : 'a t -> ('a * 'a t) option Get and remove the first element.
Same as pop, but fails on empty queues.
Remove first element. If the queue is empty, do nothing.
Append two queues. Elements from the second one come after elements of the first one. Linear in the size of the second queue.
Sourceval map : ('a -> 'b) -> 'a t -> 'b t Reverse the queue. Constant time.
Sourceval equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool include module type of Infix
Sourceval (>|=) : 'a t -> ('a -> 'b) -> 'b t Number of elements in the queue (linear in time).
Sourceval fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b Sourceval iter : ('a -> unit) -> 'a t -> unit Sourceval to_list : 'a t -> 'a list Sourceval add_list : 'a t -> 'a list -> 'a t Sourceval of_list : 'a list -> 'a t IO