package base

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Using_comparator is a similar interface as the toplevel of Map, except the functions take a ~comparator:('k, 'cmp) Comparator.t, whereas the functions at the toplevel of Map take a ('k, 'cmp) comparator.

type nonrec ('k, +'v, 'cmp) t = ('k, 'v, 'cmp) t
val sexp_of_t : ('k -> Sexplib0.Sexp.t) -> ('v -> Sexplib0.Sexp.t) -> ('cmp -> Sexplib0.Sexp.t) -> ('k, 'v, 'cmp) t -> Sexplib0.Sexp.t
val t_of_sexp_direct : comparator:('k, 'cmp) Comparator.t -> (Sexp.t -> 'k) -> (Sexp.t -> 'v) -> Sexp.t -> ('k, 'v, 'cmp) t
module Tree : sig ... end
val empty : comparator:('k, 'cmp) Comparator.t -> ('k, _, 'cmp) t
val singleton : comparator:('k, 'cmp) Comparator.t -> 'k -> 'v -> ('k, 'v, 'cmp) t
val map_keys : comparator:('k2, 'cmp2) Comparator.t -> ('k1, 'v, 'cmp1) t -> f:('k1 -> 'k2) -> [ `Ok of ('k2, 'v, 'cmp2) t | `Duplicate_key of 'k2 ]
val map_keys_exn : comparator:('k2, 'cmp2) Comparator.t -> ('k1, 'v, 'cmp1) t -> f:('k1 -> 'k2) -> ('k2, 'v, 'cmp2) t
val transpose_keys : comparator:('k2, 'cmp2) Comparator.t -> ('k1, ('k2, 'a, 'cmp2) t, 'cmp1) t -> ('k2, ('k1, 'a, 'cmp1) t, 'cmp2) t
val of_sorted_array : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) array -> ('k, 'v, 'cmp) t Or_error.t
val of_sorted_array_unchecked : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) array -> ('k, 'v, 'cmp) t
val of_increasing_iterator_unchecked : comparator:('k, 'cmp) Comparator.t -> len:int -> f:(int -> 'k * 'v) -> ('k, 'v, 'cmp) t
val of_alist : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) list -> [ `Ok of ('k, 'v, 'cmp) t | `Duplicate_key of 'k ]
val of_alist_or_error : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) list -> ('k, 'v, 'cmp) t Or_error.t
val of_alist_exn : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) list -> ('k, 'v, 'cmp) t
val of_alist_multi : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) list -> ('k, 'v list, 'cmp) t
val of_alist_fold : comparator:('k, 'cmp) Comparator.t -> ('k * 'v1) list -> init:'v2 -> f:('v2 -> 'v1 -> 'v2) -> ('k, 'v2, 'cmp) t
val of_alist_reduce : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) list -> f:('v -> 'v -> 'v) -> ('k, 'v, 'cmp) t
val of_increasing_sequence : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) Sequence.t -> ('k, 'v, 'cmp) t Or_error.t
val of_sequence : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) Sequence.t -> [ `Ok of ('k, 'v, 'cmp) t | `Duplicate_key of 'k ]
val of_sequence_or_error : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) Sequence.t -> ('k, 'v, 'cmp) t Or_error.t
val of_sequence_exn : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) Sequence.t -> ('k, 'v, 'cmp) t
val of_sequence_multi : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) Sequence.t -> ('k, 'v list, 'cmp) t
val of_sequence_fold : comparator:('k, 'cmp) Comparator.t -> ('k * 'v1) Sequence.t -> init:'v2 -> f:('v2 -> 'v1 -> 'v2) -> ('k, 'v2, 'cmp) t
val of_sequence_reduce : comparator:('k, 'cmp) Comparator.t -> ('k * 'v) Sequence.t -> f:('v -> 'v -> 'v) -> ('k, 'v, 'cmp) t
val of_list_with_key : comparator:('k, 'cmp) Comparator.t -> 'v list -> get_key:('v -> 'k) -> [ `Ok of ('k, 'v, 'cmp) t | `Duplicate_key of 'k ]
val of_list_with_key_or_error : comparator:('k, 'cmp) Comparator.t -> 'v list -> get_key:('v -> 'k) -> ('k, 'v, 'cmp) t Or_error.t
val of_list_with_key_exn : comparator:('k, 'cmp) Comparator.t -> 'v list -> get_key:('v -> 'k) -> ('k, 'v, 'cmp) t
val of_list_with_key_multi : comparator:('k, 'cmp) Comparator.t -> 'v list -> get_key:('v -> 'k) -> ('k, 'v list, 'cmp) t
val of_list_with_key_fold : comparator:('k, 'cmp) Comparator.t -> 'v list -> get_key:('v -> 'k) -> init:'acc -> f:('acc -> 'v -> 'acc) -> ('k, 'acc, 'cmp) t
val of_list_with_key_reduce : comparator:('k, 'cmp) Comparator.t -> 'v list -> get_key:('v -> 'k) -> f:('v -> 'v -> 'v) -> ('k, 'v, 'cmp) t
val of_iteri : comparator:('k, 'cmp) Comparator.t -> iteri:(f:(key:'k -> data:'v -> unit) -> unit) -> [ `Ok of ('k, 'v, 'cmp) t | `Duplicate_key of 'k ]
val of_iteri_exn : comparator:('k, 'cmp) Comparator.t -> iteri:(f:(key:'k -> data:'v -> unit) -> unit) -> ('k, 'v, 'cmp) t
val of_tree : comparator:('k, 'cmp) Comparator.t -> ('k, 'v, 'cmp) Tree.t -> ('k, 'v, 'cmp) t
val invariants : ('k, 'v, 'cmp) t -> bool
val is_empty : (_, _, _) t -> bool
val length : (_, _, _) t -> int
val add : ('k, 'v, 'cmp) t -> key:'k -> data:'v -> [ `Ok of ('k, 'v, 'cmp) t | `Duplicate ]
val add_exn : ('k, 'v, 'cmp) t -> key:'k -> data:'v -> ('k, 'v, 'cmp) t
val set : ('k, 'v, 'cmp) t -> key:'k -> data:'v -> ('k, 'v, 'cmp) t
val add_multi : ('k, 'v list, 'cmp) t -> key:'k -> data:'v -> ('k, 'v list, 'cmp) t
val remove_multi : ('k, 'v list, 'cmp) t -> 'k -> ('k, 'v list, 'cmp) t
val find_multi : ('k, 'v list, 'cmp) t -> 'k -> 'v list
val change : ('k, 'v, 'cmp) t -> 'k -> f:('v option -> 'v option) -> ('k, 'v, 'cmp) t
val update : ('k, 'v, 'cmp) t -> 'k -> f:('v option -> 'v) -> ('k, 'v, 'cmp) t
val find : ('k, 'v, 'cmp) t -> 'k -> 'v option
val find_exn : ('k, 'v, 'cmp) t -> 'k -> 'v
val remove : ('k, 'v, 'cmp) t -> 'k -> ('k, 'v, 'cmp) t
val mem : ('k, _, 'cmp) t -> 'k -> bool
val iter_keys : ('k, _, _) t -> f:('k -> unit) -> unit
val iter : (_, 'v, _) t -> f:('v -> unit) -> unit
val iteri : ('k, 'v, _) t -> f:(key:'k -> data:'v -> unit) -> unit
val iteri_until : ('k, 'v, _) t -> f:(key:'k -> data:'v -> Continue_or_stop.t) -> Finished_or_unfinished.t
val iter2 : ('k, 'v1, 'cmp) t -> ('k, 'v2, 'cmp) t -> f: (key:'k -> data:[ `Left of 'v1 | `Right of 'v2 | `Both of 'v1 * 'v2 ] -> unit) -> unit
val map : ('k, 'v1, 'cmp) t -> f:('v1 -> 'v2) -> ('k, 'v2, 'cmp) t
val mapi : ('k, 'v1, 'cmp) t -> f:(key:'k -> data:'v1 -> 'v2) -> ('k, 'v2, 'cmp) t
val fold : ('k, 'v, _) t -> init:'acc -> f:(key:'k -> data:'v -> 'acc -> 'acc) -> 'acc
val fold_until : ('k, 'v, _) t -> init:'acc -> f:(key:'k -> data:'v -> 'acc -> ('acc, 'final) Container.Continue_or_stop.t) -> finish:('acc -> 'final) -> 'final
val fold_right : ('k, 'v, _) t -> init:'acc -> f:(key:'k -> data:'v -> 'acc -> 'acc) -> 'acc
val fold2 : ('k, 'v1, 'cmp) t -> ('k, 'v2, 'cmp) t -> init:'acc -> f: (key:'k -> data:[ `Left of 'v1 | `Right of 'v2 | `Both of 'v1 * 'v2 ] -> 'acc -> 'acc) -> 'acc
val filter_keys : ('k, 'v, 'cmp) t -> f:('k -> bool) -> ('k, 'v, 'cmp) t
val filter : ('k, 'v, 'cmp) t -> f:('v -> bool) -> ('k, 'v, 'cmp) t
val filteri : ('k, 'v, 'cmp) t -> f:(key:'k -> data:'v -> bool) -> ('k, 'v, 'cmp) t
val filter_map : ('k, 'v1, 'cmp) t -> f:('v1 -> 'v2 option) -> ('k, 'v2, 'cmp) t
val filter_mapi : ('k, 'v1, 'cmp) t -> f:(key:'k -> data:'v1 -> 'v2 option) -> ('k, 'v2, 'cmp) t
val partition_mapi : ('k, 'v1, 'cmp) t -> f:(key:'k -> data:'v1 -> ('v2, 'v3) Either.t) -> ('k, 'v2, 'cmp) t * ('k, 'v3, 'cmp) t
val partition_map : ('k, 'v1, 'cmp) t -> f:('v1 -> ('v2, 'v3) Either.t) -> ('k, 'v2, 'cmp) t * ('k, 'v3, 'cmp) t
val partitioni_tf : ('k, 'v, 'cmp) t -> f:(key:'k -> data:'v -> bool) -> ('k, 'v, 'cmp) t * ('k, 'v, 'cmp) t
val partition_tf : ('k, 'v, 'cmp) t -> f:('v -> bool) -> ('k, 'v, 'cmp) t * ('k, 'v, 'cmp) t
val combine_errors : ('k, 'v Or_error.t, 'cmp) t -> ('k, 'v, 'cmp) t Or_error.t
val unzip : ('k, 'v1 * 'v2, 'cmp) t -> ('k, 'v1, 'cmp) t * ('k, 'v2, 'cmp) t
val compare_direct : ('v -> 'v -> int) -> ('k, 'v, 'cmp) t -> ('k, 'v, 'cmp) t -> int
val equal : ('v -> 'v -> bool) -> ('k, 'v, 'cmp) t -> ('k, 'v, 'cmp) t -> bool
val keys : ('k, _, _) t -> 'k list
val data : (_, 'v, _) t -> 'v list
val to_alist : ?key_order:[ `Increasing | `Decreasing ] -> ('k, 'v, _) t -> ('k * 'v) list
val merge : ('k, 'v1, 'cmp) t -> ('k, 'v2, 'cmp) t -> f: (key:'k -> [ `Left of 'v1 | `Right of 'v2 | `Both of 'v1 * 'v2 ] -> 'v3 option) -> ('k, 'v3, 'cmp) t
val merge_disjoint_exn : ('k, 'v, 'cmp) t -> ('k, 'v, 'cmp) t -> ('k, 'v, 'cmp) t
val merge_skewed : ('k, 'v, 'cmp) t -> ('k, 'v, 'cmp) t -> combine:(key:'k -> 'v -> 'v -> 'v) -> ('k, 'v, 'cmp) t
val symmetric_diff : ('k, 'v, 'cmp) t -> ('k, 'v, 'cmp) t -> data_equal:('v -> 'v -> bool) -> ('k * [ `Left of 'v | `Right of 'v | `Unequal of 'v * 'v ]) Sequence.t
val fold_symmetric_diff : ('k, 'v, 'cmp) t -> ('k, 'v, 'cmp) t -> data_equal:('v -> 'v -> bool) -> init:'acc -> f: ('acc -> ('k * [ `Left of 'v | `Right of 'v | `Unequal of 'v * 'v ]) -> 'acc) -> 'acc
val min_elt : ('k, 'v, _) t -> ('k * 'v) option
val min_elt_exn : ('k, 'v, _) t -> 'k * 'v
val max_elt : ('k, 'v, _) t -> ('k * 'v) option
val max_elt_exn : ('k, 'v, _) t -> 'k * 'v
val for_all : ('k, 'v, _) t -> f:('v -> bool) -> bool
val for_alli : ('k, 'v, _) t -> f:(key:'k -> data:'v -> bool) -> bool
val exists : ('k, 'v, _) t -> f:('v -> bool) -> bool
val existsi : ('k, 'v, _) t -> f:(key:'k -> data:'v -> bool) -> bool
val count : ('k, 'v, _) t -> f:('v -> bool) -> int
val counti : ('k, 'v, _) t -> f:(key:'k -> data:'v -> bool) -> int
val sum : (module Container.Summable with type t = 'a) -> ('k, 'v, _) t -> f:('v -> 'a) -> 'a
val sumi : (module Container.Summable with type t = 'a) -> ('k, 'v, _) t -> f:(key:'k -> data:'v -> 'a) -> 'a
val split : ('k, 'v, 'cmp) t -> 'k -> ('k, 'v, 'cmp) t * ('k * 'v) option * ('k, 'v, 'cmp) t
val split_le_gt : ('k, 'v, 'cmp) t -> 'k -> ('k, 'v, 'cmp) t * ('k, 'v, 'cmp) t
val split_lt_ge : ('k, 'v, 'cmp) t -> 'k -> ('k, 'v, 'cmp) t * ('k, 'v, 'cmp) t
val append : lower_part:('k, 'v, 'cmp) t -> upper_part:('k, 'v, 'cmp) t -> [ `Ok of ('k, 'v, 'cmp) t | `Overlapping_key_ranges ]
val subrange : ('k, 'v, 'cmp) t -> lower_bound:'k Maybe_bound.t -> upper_bound:'k Maybe_bound.t -> ('k, 'v, 'cmp) t
val fold_range_inclusive : ('k, 'v, 'cmp) t -> min:'k -> max:'k -> init:'acc -> f:(key:'k -> data:'v -> 'acc -> 'acc) -> 'acc
val range_to_alist : ('k, 'v, 'cmp) t -> min:'k -> max:'k -> ('k * 'v) list
val closest_key : ('k, 'v, 'cmp) t -> [ `Greater_or_equal_to | `Greater_than | `Less_or_equal_to | `Less_than ] -> 'k -> ('k * 'v) option
val nth : ('k, 'v, 'cmp) t -> int -> ('k * 'v) option
val nth_exn : ('k, 'v, 'cmp) t -> int -> 'k * 'v
val rank : ('k, _, 'cmp) t -> 'k -> int option
val to_tree : ('k, 'v, 'cmp) t -> ('k, 'v, 'cmp) Tree.t
val to_sequence : ?order:[ `Increasing_key | `Decreasing_key ] -> ?keys_greater_or_equal_to:'k -> ?keys_less_or_equal_to:'k -> ('k, 'v, 'cmp) t -> ('k * 'v) Sequence.t
val binary_search_segmented : ('k, 'v, 'cmp) t -> segment_of:(key:'k -> data:'v -> [ `Left | `Right ]) -> Binary_searchable.Which_target_by_segment.t -> ('k * 'v) option
val binary_search_subrange : ('k, 'v, 'cmp) t -> compare:(key:'k -> data:'v -> 'bound -> int) -> lower_bound:'bound Maybe_bound.t -> upper_bound:'bound Maybe_bound.t -> ('k, 'v, 'cmp) t
val comparator : ('a, _, 'cmp) t -> ('a, 'cmp) Comparator.t
val hash_fold_direct : 'k Hash.folder -> 'v Hash.folder -> ('k, 'v, 'cmp) t Hash.folder

To get around the value restriction, apply the functor and include it. You can see an example of this in the Poly submodule below.

OCaml

Innovation. Community. Security.