open Funs
(*************************************)
(* Part 2: Three-Way Search Tree *)
(*************************************)
type int_tree =
| IntLeaf
| IntNode of int * int option * int_tree * int_tree * int_tree
let empty_int_tree = IntLeaf
let rec int_insert x t =
failwith “unimplemented”
let rec int_mem x t =
failwith “unimplemented”
let rec int_size t =
failwith “unimplemented”
let rec int_max t =
failwith “unimplemented”
(*******************************)
(* Part 3: Three-Way Search Tree-Based Map *)
(*******************************)
type ‘a tree_map =
| MapLeaf
| MapNode of (int * ‘a) * (int * ‘a) option * ‘a tree_map * ‘a tree_map * ‘a tree_map
let empty_tree_map = MapLeaf
let rec map_put k v t =
failwith “unimplemented”
let rec map_contains k t =
failwith “unimplemented”
let rec map_get k t =
failwith “unimplemented”
(***************************)
(* Part 4: Variable Lookup *)
(***************************)
type lookup_table = (string * int) list list
let empty_table = []
let push_scope (table:lookup_table) : lookup_table =
failwith “unimplemented”
let pop_scope (table:lookup_table) : lookup_table =
failwith “unimplemented”
let var_exists name scope =
failwith “unimplemented”
let add_var name value (table:lookup_table) : lookup_table =
failwith “unimplemented”
let rec lookup name (table:lookup_table) =
failwith “unimplemented”