diff --git a/src/core/CCHeap.ml b/src/core/CCHeap.ml index 42949926..b19e3857 100644 --- a/src/core/CCHeap.ml +++ b/src/core/CCHeap.ml @@ -258,20 +258,19 @@ module Make(E : PARTIAL_ORD) : S with type elt = E.t = struct let delete_one eq x h = let rec aux = function | E -> false, E - | N(_, y, l, r) as h -> begin + | N(_, y, l, r) as h -> if eq x y then true, merge l r - else begin + else ( if E.leq y x - then begin + then ( let found_left, l1 = aux l in let found, r1 = if found_left then true, r else aux r in if found then true, _make_node y l1 r1 else false, h - end + ) else false, h - end - end + ) in snd (aux h) @@ -279,11 +278,11 @@ module Make(E : PARTIAL_ORD) : S with type elt = E.t = struct | E -> E | N (_, y, l, r) as h -> if eq x y then merge (delete_all eq x l) (delete_all eq x r) - else begin + else ( if E.leq y x then _make_node y (delete_all eq x l) (delete_all eq x r) else h - end + ) let rec iter f h = match h with | E -> () diff --git a/src/core/CCList.ml b/src/core/CCList.ml index 64c56289..04ae2049 100644 --- a/src/core/CCList.ml +++ b/src/core/CCList.ml @@ -858,13 +858,13 @@ let head_opt = function let tail_opt = function | [] -> None | _ :: tail -> Some tail - + (*$= & ~printer:Q.Print.(option (list int)) (Some [2;3]) (tail_opt [1;2;3]) (Some []) (tail_opt [1]) None (tail_opt []) *) - + let rec last_opt = function | [] -> None | [x] -> Some x