package containers-data

  1. Overview
  2. Docs
A set of advanced datatypes for containers

Install

Dune Dependency

Authors

Maintainers

Sources

v3.0.1.tar.gz
md5=438a7bbcb789e116eead04c8a59641f0
sha512=b5551a9ebb9500e14482852c9294c9b4cc3df8153ba64b8e4c4de1dacbd0322ebe4a212316b308c94af562a40099c85b89a8415780cf4e2e0e519870f7342c1b

doc/containers-data/CCWBTree/module-type-S/index.html

Module type CCWBTree.SSource

Sourcetype key
Sourcetype +'a t
Sourceval empty : 'a t
Sourceval is_empty : _ t -> bool
Sourceval singleton : key -> 'a -> 'a t
Sourceval mem : key -> _ t -> bool
Sourceval get : key -> 'a t -> 'a option
Sourceval get_exn : key -> 'a t -> 'a
Sourceval nth : int -> 'a t -> (key * 'a) option

nth i m returns the i-th key, value in the ascending order. Complexity is O(log (cardinal m)).

Sourceval nth_exn : int -> 'a t -> key * 'a
Sourceval get_rank : key -> 'a t -> [ `At of int | `After of int | `First ]

get_rank k m looks for the rank of k in m, i.e. the index of k in the sorted list of bindings of m. let (`At n) = get_rank k m in nth_exn n m = get m k should hold.

  • since 1.4
Sourceval add : key -> 'a -> 'a t -> 'a t
Sourceval remove : key -> 'a t -> 'a t
Sourceval update : key -> ('a option -> 'a option) -> 'a t -> 'a t

update k f m calls f (Some v) if get k m = Some v, f None otherwise. Then, if f returns Some v' it binds k to v', if f returns None it removes k.

Sourceval cardinal : _ t -> int
Sourceval weight : _ t -> int
Sourceval fold : f:('b -> key -> 'a -> 'b) -> x:'b -> 'a t -> 'b
Sourceval mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b t

Map values, giving both key and value. Will use WORD.of_list to rebuild keys.

  • since 0.17
Sourceval map : f:('a -> 'b) -> 'a t -> 'b t

Map values, giving only the value.

  • since 0.17
Sourceval iter : f:(key -> 'a -> unit) -> 'a t -> unit
Sourceval split : key -> 'a t -> 'a t * 'a option * 'a t

split k t returns l, o, r where l is the part of the map with keys smaller than k, r has keys bigger than k, and o = Some v if k, v belonged to the map.

Sourceval merge : f:(key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
Sourceval extract_min : 'a t -> key * 'a * 'a t

extract_min m returns k, v, m' where k,v is the pair with the smallest key in m, and m' does not contain k.

Sourceval extract_max : 'a t -> key * 'a * 'a t

extract_max m returns k, v, m' where k,v is the pair with the highest key in m, and m' does not contain k.

Sourceval choose : 'a t -> (key * 'a) option
Sourceval choose_exn : 'a t -> key * 'a
Sourceval random_choose : Random.State.t -> 'a t -> key * 'a

Randomly choose a (key,value) pair within the tree, using weights as probability weights.

Sourceval add_list : 'a t -> (key * 'a) list -> 'a t
Sourceval of_list : (key * 'a) list -> 'a t
Sourceval to_list : 'a t -> (key * 'a) list
Sourceval add_iter : 'a t -> (key * 'a) iter -> 'a t
Sourceval of_iter : (key * 'a) iter -> 'a t
Sourceval to_iter : 'a t -> (key * 'a) iter
Sourceval add_gen : 'a t -> (key * 'a) gen -> 'a t
Sourceval of_gen : (key * 'a) gen -> 'a t
Sourceval to_gen : 'a t -> (key * 'a) gen
Sourceval pp : ?pp_start:unit printer -> ?pp_stop:unit printer -> ?pp_arrow:unit printer -> ?pp_sep:unit printer -> key printer -> 'a printer -> 'a t printer

Renamed from val print.

  • since 2.0
OCaml

Innovation. Community. Security.