Detect cycles in type declarations
[tiger.ml.git] / compiler / src / lib / tiger / tiger_map_red_black.ml
index 30ba479..4713943 100644 (file)
@@ -102,3 +102,9 @@ let to_dot t ~k_to_string =
 
 let of_list pairs =
   List.fold_left pairs ~init:empty ~f:(fun t (k, v) -> set t ~k ~v)
+
+let rec to_list = function
+  | Leaf ->
+      []
+  | Node (_, pair, left, right) ->
+      pair :: ((to_list left) @ (to_list right))
This page took 0.020533 seconds and 4 git commands to generate.