@@ -225,7 +225,7 @@ module internal MapExtImplementation =
225225 None
226226
227227
228- let rec tryRemoveMin m =
228+ let rec tryRemoveMin cmp m =
229229 match m with
230230 | MapEmpty ->
231231 None
@@ -234,15 +234,15 @@ module internal MapExtImplementation =
234234 Some ( k2, v, MapEmpty)
235235
236236 | MapNode( k2, v2, l, r,_,_) ->
237- match tryRemoveMin l with
237+ match tryRemoveMin cmp l with
238238 | Some ( k, v, rest) ->
239239 match rest with
240- | MapEmpty -> Some ( k, v , r)
241- | _ -> Some ( k, v, rebalance rest k2 v2 r)
240+ | MapEmpty -> Some ( k, v , add cmp k2 v2 r)
241+ | _ -> Some ( k, v, rebalance rest k2 v2 r)
242242 | None ->
243243 Some( k2, v2, r)
244244
245- let rec tryRemoveMax m =
245+ let rec tryRemoveMax cmp m =
246246 match m with
247247 | MapEmpty ->
248248 None
@@ -251,11 +251,11 @@ module internal MapExtImplementation =
251251 Some ( k2, v, MapEmpty)
252252
253253 | MapNode( k2, v2, l, r,_,_) ->
254- match tryRemoveMax r with
254+ match tryRemoveMax cmp r with
255255 | Some ( k, v, rest) ->
256256 match rest with
257- | MapEmpty -> Some ( k, v , l)
258- | _ -> Some ( k, v, rebalance l k2 v2 rest)
257+ | MapEmpty -> Some ( k, v , add cmp k2 v2 l)
258+ | _ -> Some ( k, v, rebalance l k2 v2 rest)
259259 | None ->
260260 Some( k2, v2, l)
261261
@@ -1583,12 +1583,12 @@ type internal MapExt<[<EqualityConditionalOn>]'Key,[<EqualityConditionalOn;Compa
15831583 | _ -> None
15841584
15851585 member x.TryRemoveMin () =
1586- match MapTree.tryRemoveMin tree with
1586+ match MapTree.tryRemoveMin comparer tree with
15871587 | Some ( k, v, t) -> Some( k, v, MapExt( comparer, t))
15881588 | None -> None
15891589
15901590 member x.TryRemoveMax () =
1591- match MapTree.tryRemoveMax tree with
1591+ match MapTree.tryRemoveMax comparer tree with
15921592 | Some ( k, v, t) -> Some( k, v, MapExt( comparer, t))
15931593 | None -> None
15941594
@@ -1628,6 +1628,9 @@ type internal MapExt<[<EqualityConditionalOn>]'Key,[<EqualityConditionalOn;Compa
16281628 new MapExt< 'Key, 'Value>( comparer, r1), new MapExt< 'Key, 'Value>( comparer, r2)
16291629
16301630 member m.Count = MapTree.size tree
1631+
1632+ member x.TryMin = MapTree.tryMin tree
1633+ member x.TryMax = MapTree.tryMax tree
16311634
16321635 member x.TryMinKey = MapTree.tryMin tree |> Option.map fst
16331636 member x.TryMaxKey = MapTree.tryMax tree |> Option.map fst
0 commit comments