mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
style fixes
This commit is contained in:
parent
364890ca36
commit
3b8f7099cb
2 changed files with 9 additions and 10 deletions
|
|
@ -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 -> ()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue