Module Common.Util

module Util: sig .. end

val uuid : unit -> string
return a unique identifier based on random numbers
val list_unique : 'a list -> 'a list
return a list of unique elements. This algorithm runs in O(n) but is not stable . elements are returned in reverse order
val memo : ('a -> 'b) -> 'a -> 'b
A generic memoization function. To use with care as it allocates an hashtbl storing all results that will be released only on exit
val timestamp : unit -> string

Debug, ProgressBars, Timers and Loggers
type label = string 
module type Messages = sig .. end
module Debug: Messages 
Debug, Info and Warning messages are printed immediately on stderr.
module Warning: Messages 
module Info: Messages 
module Notice: Messages 

Ex : To use the Message framework, you should declare three functions * at the begin of each module as:

let debug fmt = Util.make_debug "MyModuleLabel" fmt let info fmt = Util.make_info "MyModuleLabel" fmt let warning fmt = Util.make_warning "MyModuleLabel" fmt

and then use these function as

debug "this is a message string %s" "a string"

To enable this handle, from the main program use the function

Debug.enable "MyModuleLabel"

#define __label __FILE__ let label = __label ;; include Util.Logging(struct let label = label end) ;;

module Logging: 
functor (X : sig
val label : string
end) -> sig .. end
module Progress: sig .. end
ProgressBars are printed immediately on stderr.
module Timer: sig .. end
Timers are printed all at once by the dump function on stderr.
module IntHashtbl: Hashtbl.S  with type key = int
module IntPairHashtbl: Hashtbl.S  with type key = int * int
module StringHashtbl: Hashtbl.S  with type key = string
module StringPairHashtbl: Hashtbl.S  with type key = string * string
val range : int -> int -> int list
val string_of_list : ?delim:string * string -> ?sep:string -> ('a -> string) -> 'a list -> string
class type projection = object .. end
associate a sat solver variable to a package id
class identity : projection
identity projection
class intprojection : int -> projection
intprojection n integer projection of size n