From: Nicolas C. <war...@fr...> - 2003-05-30 03:59:36
|
> let enum_dup c val = > (* returns an enumeration which is just val repeated c times *) > let cref = ref c in > let next () = if (!cref) > 0 then decr cref; val > else raise No_more_elements > and count () = !cref > in > Enum.make ~next:next ~count:count Added to the CVS : Enum.init : int -> (int -> 'a) -> 'a t Similar to List.init and Array.init Nicolas Cannasse |