Yaron Minsky avatar Yaron Minsky committed 376e739

more conversions

Comments (0)

Files changed (4)

     sendmail.cmo \
     mTimer.cmo \
     ehandlers.cmo \
+    prime.cmo \
+    rMisc.cmo \
 
 
 
 (* USA or see <http://www.gnu.org/licenses/>.                          *)
 (***********************************************************************)
 
-open StdLabels
-open MoreLabels
-open Printf
-
 open Common
+open Core.Std
 open Eventloop
-module Unix = UnixLabels
 
 (** Repeat callback ~request with a gap of redo_timeout, until
   either (test ()) is true or full_timeout has expired.
 
 
 (** returns smallest floating point number larger than the argument *)
-let float_incr x = x +. x *. epsilon_float
-let float_decr x = x -. x *. epsilon_float
+let float_incr x = x +. x *. Float.epsilon
+let float_decr x = x -. x *. Float.epsilon
 
 let strftime time =
   let tm = Unix.localtime time in
 (* USA or see <http://www.gnu.org/licenses/>.                          *)
 (***********************************************************************)
 
-open StdLabels
-open MoreLabels
-module Unix=UnixLabels
+open Core.Std
 open Number.Infix
 
 (** returns random string with exactly <bits> bits.  Highest order bit is
   rval
 
 (** chooses random int between 0 and high-1 *)
-let rec randint rfunc high =
+let randint rfunc high =
   let nbits = Number.nbits high in
   let nbytes = nbits / 8 + (if nbits mod 8 = 0 then 0 else 1) in
   let rstring = Utils.random_string rfunc nbytes in
 (* USA or see <http://www.gnu.org/licenses/>.                          *)
 (***********************************************************************)
 
-open StdLabels
-open MoreLabels
-module Unix=UnixLabels
+open Core.Std
 
 (** deterministic RNG *)
 let det_rng = Random.State.make [|104|]
-module Set = PSet.Set (* was: Polyset.Set *)
-module Map = PMap.Map
 
 let stringset_to_string stringset =
   let list = List.sort ~cmp:compare (Set.elements stringset) in
 (************************************************************)
 
 let add_random rfunc bytelength set =
-  Set.add (random_string rfunc bytelength) set
+  Set.add set (random_string rfunc bytelength)
 
 let add_n_random rfunc bytelength ~n set =
   Utils.apply n (add_random rfunc bytelength) set
 let det_string_set ~bytes ~size =
   add_n_random
     (fun () -> Random.State.bits det_rng)
-    bytes ~n:size Set.empty
+    bytes ~n:size String.Set.empty
 
 let rand_string_set ~bytes ~size =
-  add_n_random Random.bits bytes ~n:size Set.empty
+  add_n_random Random.bits bytes ~n:size String.Set.empty
 
 let localize_string_set ~bytes ~diff set =
   add_n_random Random.bits bytes ~n:diff set
 *)
 
 let add_sarray ~data sarray =
-  Array.fold_right ~f:(fun string set -> Set.add string set)
-    sarray ~init:data
+  Array.fold_right ~init:data sarray
+    ~f:(fun x set -> Set.add set x)
 
 (*****************************************************************)
 (*****************************************************************)
 
 
 let padset stringset bytes =
-  Set.fold ~f:(fun el set -> Set.add (pad el bytes) set)
-    ~init:Set.empty stringset
+  Set.fold ~f:(fun set el -> Set.add set (pad el bytes))
+    ~init:String.Set.empty stringset
 
 let truncate string bytes =
   let len = String.length string in
     string
 
 let truncset stringset bytes =
-  Set.fold ~f:(fun el set -> Set.add (truncate el bytes) set)
-    ~init:Set.empty stringset
+  Set.fold ~f:(fun set el -> Set.add set (truncate el bytes))
+    ~init:String.Set.empty stringset
 
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.