Commit 5f7713cb authored by POTTIER Francois's avatar POTTIER Francois

Added [LowIntegerPriorityQueue.repeat].

parent 81871f0c
......@@ -63,3 +63,10 @@ let remove q =
else
remove_nonempty q
let rec repeat q f =
match remove q with
| None ->
()
| Some x ->
f x;
repeat q f
......@@ -18,3 +18,8 @@ val is_empty: 'a t -> bool
(** [cardinal q] returns the number of elements in the queue [q]. *)
val cardinal: 'a t -> int
(** [repeat q f] repeatedly extracts an element with minimum priority out of [q]
and passes it to [f] (which may insert new elements into [q]), until [q] is
exhausted. *)
val repeat: 'a t -> ('a -> unit) -> unit
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment