This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
26
unikernel/duniverse/psq/.ocamlinit
Normal file
26
unikernel/duniverse/psq/.ocamlinit
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#require "fmt"
|
||||
(* #directory "_build/src" *)
|
||||
(* #load "psq.cma" *)
|
||||
|
||||
let shuff arr =
|
||||
let n = Array.length arr in
|
||||
for i = 0 to n - 2 do
|
||||
let j = Random.int (n - i) + i in
|
||||
let t = arr.(i) in
|
||||
arr.(i) <- arr.(j);
|
||||
arr.(j) <- t
|
||||
done
|
||||
|
||||
let permutation n =
|
||||
let arr = Array.init n (fun x -> x) in
|
||||
shuff arr;
|
||||
Array.to_list arr
|
||||
|
||||
let rec (--) a b = if a > b then [] else a :: succ a -- b
|
||||
|
||||
module I = struct type t = int let compare = compare end
|
||||
module Q = Psq.Make (I) (I)
|
||||
|
||||
let pp_q = Q.pp_dump Fmt.int Fmt.int
|
||||
;;
|
||||
#install_printer pp_q
|
||||
Loading…
Add table
Add a link
Reference in a new issue