Revision: 423
Author: ygrekheretix
Date: Tue Nov 12 15:53:35 2013 UTC
Log: add Enum.next
http://code.google.com/p/ocaml-extlib/source/detail?r=423
Modified:
/trunk/extlib/
enum.ml
/trunk/extlib/enum.mli
=======================================
--- /trunk/extlib/
enum.ml Thu May 6 09:44:41 2004 UTC
+++ /trunk/extlib/
enum.ml Tue Nov 12 15:53:35 2013 UTC
@@ -124,6 +124,8 @@
e.count <- (fun () -> force e; e.count());
e
+let next t = t.next ()
+
let get t =
try
Some (t.next())
=======================================
--- /trunk/extlib/enum.mli Sat Feb 2 09:32:49 2008 UTC
+++ /trunk/extlib/enum.mli Tue Nov 12 15:53:35 2013 UTC
@@ -88,6 +88,10 @@
(** [get e] returns [None] if [e] is empty or [Some x] where [x] is
the next element of [e], in which case the element is removed from the
enumeration. *)
+val next : 'a t -> 'a
+(** [next e] returns the next element of [e] (and removes it from
enumeration).
+ @raise No_more_elements if enumeration is empty *)
+
val push : 'a t -> 'a -> unit
(** [push e x] will add [x] at the beginning of [e]. *)