Anonymous avatar Anonymous committed cb4dbe1

Minor improvements to [delete].

Comments (0)

Files changed (1)

     let ifdz_b_ = function R (z, a, b) -> B (z, a, b), false | u -> u, true
     
     let rec delete_aux_ k = function
-        | Z -> raise Not_found
-        | B (y, a, b) -> delete_aux_mirror_ cons_b_ ifdz_b_ k y a b
-        | R (y, a, b) -> delete_aux_mirror_ cons_r_ ifdz_r_ k y a b
-
+        | Z ->
+            raise Not_found
+        | B (y, a, b) ->
+            delete_aux_mirror_ cons_b_ ifdz_b_ k y a b
+        | R (y, a, b) ->
+            delete_aux_mirror_ cons_r_ ifdz_r_ k y a b
+    
     and delete_aux_mirror_ cons ifdz k y a b =
         let d = N.kcompare k y in
-        if d < 0 then begin
+        if d > 0 then begin
+            let b, r = delete_aux_ k b in
+            let n = cons y a b in
+            if r then l_repair_ n else n, false
+        end
+        else if d < 0 then begin
             let a, r = delete_aux_ k a in
             let n = cons y a b in
             if r then r_repair_ n else n, false
         end
-        else if d > 0 then begin
-            let b, r = delete_aux_ k b in
-            let n = cons y a b in
-            if r then l_repair_ n else n, false
-        end
-        else if b = Z then begin
+        else match b with
+        | Z ->
             ifdz a
-        end
-        else begin
+        | b ->
             let b, z, d = extract_min_ b in
             let n = cons z a b in
             if d then l_repair_ n else n, false
-        end
-
+        
     let delete k u =
         try
             let u, _ = delete_aux_ k u 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.