blob: 7a9d2f797059c825c0d49e3fd6c61362256e5764 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
let name = __FILE__
let description = "Display the tree content after operations"
module T = Splay.Make (struct
include Int
let pp = Format.pp_print_int
end)
type t = unit T.t
let pp : Format.formatter -> t -> unit = T.pp
let tree : unit T.t ref = ref (T.empty ())
let speclist () =
[
( "--add",
Arg.Int (fun n -> tree := T.add n () !tree),
"Add an element in the tree" );
( "--del",
Arg.Int (fun n -> tree := T.remove n !tree),
"Remove an element from the tree" );
( "--get",
Arg.Int (fun n -> ignore @@ T.find n !tree),
"Get an element from the tree" );
]
let exec : string list -> t = fun _ -> !tree
|