Yaron Minsky avatar Yaron Minsky committed 13f0657

small cleanups

Comments (0)

Files changed (1)

ocaml/permutation.ml

   t
 
 let compose p q =
-  assert (Array.length p = Array.length q);
-  Array.init (Array.length p) ~f:(fun i -> p.(q.(i)))
+  assert (length p = length q);
+  Array.init (length p) ~f:(fun i -> p.(q.(i)))
 
 let inverse t =
-  let inv = id (Array.length t) in
-  for i = 0 to Array.length t - 1 do
+  let inv = Array.create ~len:(length t) 0 in
+  for i = 0 to length t - 1 do
     inv.(t.(i)) <- i
   done;
   inv
   how_long_until ~target:start ~current:(next t start) ~so_far:1
 
 let is_cycle t =
-  cycle_length t 0 = Array.length t
+  cycle_length t 0 = length t
 
 let involution n =
   let half = rand (n/2) in
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.