Module CCWBTree.MakeFull
Use the custom X.weight function
Parameters
Signature
type key= X.ttype +'a t
val empty : 'a tval is_empty : _ t -> boolval singleton : key -> 'a -> 'a tval mem : key -> _ t -> boolval get : key -> 'a t -> 'a optionval get_exn : key -> 'a t -> 'a- raises Not_found
if the key is not present.
val nth : int -> 'a t -> (key * 'a) optionnth i mreturns thei-thkey, valuein the ascending order. Complexity isO(log (cardinal m)).
val get_rank : key -> 'a t -> [ `At of int | `After of int | `First ]get_rank k mlooks for the rank ofkinm, i.e. the index ofkin the sorted list of bindings ofm.let (`At n) = get_rank k m in nth_exn n m = get m kshould hold.- since
- 1.4
val add : key -> 'a -> 'a t -> 'a tval remove : key -> 'a t -> 'a tval update : key -> ('a option -> 'a option) -> 'a t -> 'a tupdate k f mcallsf (Some v)ifget k m = Some v,f Noneotherwise. Then, iffreturnsSome v'it bindsktov', iffreturnsNoneit removesk.
val cardinal : _ t -> intval weight : _ t -> intval fold : f:('b -> key -> 'a -> 'b) -> x:'b -> 'a t -> 'bval mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b tMap values, giving both key and value. Will use
WORD.of_list to rebuild keys.- since
- 0.17
val iter : f:(key -> 'a -> unit) -> 'a t -> unitval split : key -> 'a t -> 'a t * 'a option * 'a tsplit k treturnsl, o, rwherelis the part of the map with keys smaller thank,rhas keys bigger thank, ando = Some vifk, vbelonged to the map.
val extract_min : 'a t -> key * 'a * 'a textract_min mreturnsk, v, m'wherek,vis the pair with the smallest key inm, andm'does not containk.- raises Not_found
if the map is empty.
val extract_max : 'a t -> key * 'a * 'a textract_max mreturnsk, v, m'wherek,vis the pair with the highest key inm, andm'does not containk.- raises Not_found
if the map is empty.
val choose : 'a t -> (key * 'a) optionval choose_exn : 'a t -> key * 'a- raises Not_found
if the tree is empty.
val random_choose : Stdlib.Random.State.t -> 'a t -> key * 'aRandomly choose a (key,value) pair within the tree, using weights as probability weights.
- raises Not_found
if the tree is empty.
val add_list : 'a t -> (key * 'a) list -> 'a tval of_list : (key * 'a) list -> 'a tval to_list : 'a t -> (key * 'a) listval add_iter : 'a t -> (key * 'a) iter -> 'a tval of_iter : (key * 'a) iter -> 'a tval to_iter : 'a t -> (key * 'a) iterval add_gen : 'a t -> (key * 'a) gen -> 'a tval of_gen : (key * 'a) gen -> 'a tval to_gen : 'a t -> (key * 'a) genval pp : ?pp_start:unit printer -> ?pp_stop:unit printer -> ?pp_arrow:unit printer -> ?pp_sep:unit printer -> key printer -> 'a printer -> 'a t printerRenamed from
val print.- since
- 2.0